字符串(一)

package wo;

public class Ep2 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		String str=" Where there is a will,there is a way ";
		String str1=new String("Hello");
		String str2="World";
		String str3=Integer.toHexString(1234);
		System.out.println(str1);
		System.out.println(str2);
		System.out.println(str3);
		System.out.println(str1+" "+str2+' '+str3);
		char a1=str1.charAt(0);
		String st1=str1.concat(str2);
		int a2=str.indexOf('e');
		int a3=str.length();
		String a4=str1.replace('H', 'h');
		String a5=str.toLowerCase();
		System.out.println(a1);
		System.out.println(st1);
		System.out.println(a2);
		System.out.println(a3);
		System.out.println(a4);
		System.out.println(a5);
		char arr[]=str.toCharArray();
		for(char n:arr)
		{
			System.out.print(n);
		}
		System.out.println();
		System.out.println(str.trim());

	}

}

 
發佈了36 篇原創文章 · 獲贊 0 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章