1. 程式人生 > >11.15

11.15

pri smo println i++ token import print new rgs

package AA;
import java.util.StringTokenizer;
public class LIANXI {
public static void main(String args[]) {
String s=new String("共 和 國 f");
char a[]= {‘g‘,‘c‘,‘d‘,‘f‘,‘k‘};
String g=new String(a,2,2);
String o=s.trim();
System.out.println(g);
String h=s+g;
System.out.println(h);
System.err.println(h.indexOf("f"));
System.out.println(h.charAt((h.indexOf("f"))-3));
System.out.println((h.indexOf("f"))-1);





String text="We are student";
StringTokenizer st= new StringTokenizer(text," te");
StringBuffer sb=new StringBuffer();
int i=1;
while(st.hasMoreTokens()) {
i++;
sb.append(st.nextToken());
}
System.out.println(sb.toString());

} }

11.15