A)
1) length()
2) equals(string)
3) replace(char old, char new)
4) string toLowerCase()
5) string toUpperCase()
6) char charAt(int index)
7) string trim()
8) boolean equalsIgnoreCase(string)
9) string substring(int index)
10) string substring(int index, int end)
Ex:
String a = getText(); or request.getparameter(t1);
int no = Integer.parseInt(a);
->in the above two statements the first statement taking the string from the text box. Then in second statement that content is converting into integer.
->if the content contain leading space then there is no problem in first statement. In second statement the numerical exception is raised to avoid that leading space problem the trim() method is used.
Leading space:
->the before and after the string is contain the space is called leading space.
->the before and after the string is contain the space is called leading space.
->the trim() method can reduce that leading space.
Comments
Post a Comment