int length(); |
String str1 = "Hello!";
int len = str1.length(); // len == 6 |
char charAt(int index); |
String str1 = "Hello!";
char ch = str1.charAt(0); // ch == 'H' |
int indexOf(String str); |
String str2 = "Hi World!";
int n = str2.indexOf("World"); // n == 3
int n = str2.indexOf("Sun"); // n == -1 |
int indexOf(char ch); |
String str2 = "Hi World!";
int n = str2.indexOf('!'); // n == 8
int n = str2.indexOf('T'); // n == -1 |