1.int l="xxx".indexof("a");2.String str1="hello world!".subString(0,"hello world!".indexof(" "));
String str2="hello world!".subString("hello world!".indexof(" "),"hello world!".length);
String str2="hello world!".subString("hello world!".indexof(" "),"hello world!".length);
public static void main(String[] args){
String str = "hello world";
int iPosition = str.indexOf("l");
String str1 = str.substring(0,str.indexOf(" "));
//position value , such as Char "l"
System.out.println("-------" + iPosition);
//will output "hello"
System.out.println("-------" + str1);
}
}
String str="xxx"
int y=str.indexof("a")+1;String str1="hello world!".subString(0,"hello world!".indexof(" "));
String str2="hello world!".subString("hello world!".indexof(" "),"hello world!".length-1);
%>