string length in android studio

Solutions on MaxInterview for string length in android studio by the best coders in the world

showing results for - "string length in android studio"
Eleonora
04 Jul 2019
1text = et.getText().toString();
2if (text == null || text.length() < 3 || text.length > 8) {
3    tv.setText("Invalid length, should be from 3 to 8 characters. Please check your code");
4} else {
5    a = text.substring(0,1);
6    b = text.substring(1,2);
7
8    c = text.substring(3,4);
9    if (text.length() > 3) {
10      d = text.substring(4);
11    } else {
12         d = null;
13    }
14}
15