0

Estoy realizando una aplicación en la que el usuario registra su numero telefónico.

Al dar clic en continuar se verifica que los campos no este vacíos y que tenga una longitud de 10 caracteres pero también quiero verificar que inicie con "55"

¿Cómo lo puedo hacer?.

Lo que tengo es:

btnGo.setonclicListener(){
...

    String CellphoneObtained = ETCellphoneObteined.getText().toString();


}
2

1 respuesta 1

0

String#startsWith(prefijo)

if (CellphoneObtained.startsWith("55"))  {


    // código

}

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.