标签:new str 反转字符串 reverse ring eve tostring 单词 输入
//获取用户输入的单词
String word=request.getParameter("word");
//将该单词先转StringBuffer 对象,然后再进行字符串反转
StringBuffer sb=new StringBuffer(word);
//反转字符串对象sb,使用StringBuffer 的reverse()方法
String changWord=sb.reverse().toString();
标签:new str 反转字符串 reverse ring eve tostring 单词 输入
原文地址:http://blog.51cto.com/1197822/2153934