Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

string length in android studio java

// HazaaZOOZ - java- How to get string length in android studio - java

text = et.getText().toString();
if (text == null || text.length() < 3 || text.length > 8) {
    tv.setText("Invalid length, should be from 3 to 8 characters. Please check your code");
} else {
    a = text.substring(0,1);
    b = text.substring(1,2);

    c = text.substring(3,4);
    if (text.length() > 3) {
      d = text.substring(4);
    } else {
         d = null;
    }
}
 
PREVIOUS NEXT
Tagged: #string #length #android #studio #java
ADD COMMENT
Topic
Name
6+8 =