风言枫语  

 

public static String reverseStr(String str) {
		int len = str.length();
		char ch[] = str.toCharArray();
		int begin = 0,end = len-1;
		char temp;
		while(begin<end) {
			temp = ch[begin];
			ch[begin] = ch[end];
			ch[end] = temp;
			begin++;
			end--;
		}
		return new String(ch);
	}


以上程序就是JAVA实现字符串反转的简单程序,非常简单,使用方便!!

 


新浪微博:http://weibo.com/cwtree

优酷空间:http://i.youku.com/u/UMzEzODI0NTQ4








 

posted on 2013-09-18 18:49  风言枫语  阅读(529)  评论(0编辑  收藏  举报