mardi 21 février 2017

make code execute when x starts with y

First of all, I apologize for this unclear title!

So I am making an app, and I have an if statement :

 if(num.contains(input) )
 {
      ...
 }

So, say num is 213, and input is 1, it will still execute the the block inside the statement. But I want to make an if statement that only executes when num starts with input, and the other characters after 1 don't matter.

Note: All variables are Strings

Aucun commentaire:

Enregistrer un commentaire