Check text from file

Asked

Viewed 71 times

2

I have a text file with the following content:

Name: Number: Password:

What I want to do is read this file and check if after : it has some character. Another question on the same subject: How can I check if the text of a file has the character :?

  • texto.contains(":")?

  • Regular expression serves perfectly for this

1 answer

1

To check whether the file contains the character ':'

String textoDoArquivo = FileUtils.readFileToString(seuArquivo);
if(textoDoArquivo.contains(':'){
     //O caractere está presente no arquivo
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.