/**
* 将一个字符串中字母替换为下一个字母
* @param src
* @return
*/
public String converToNext(String src)
{
StringBuffer target=new StringBuffer();
char[] chars=src.toCharArray();
for (int i = 0; i < chars.length; i++) {
char temp=chars[i];
if(temp<'0'||temp>'9')
{
if(temp=='z')
{
temp='a';
}
else if(temp=='Z')
{
temp='A';
}
else
{
temp=(char)(((int) temp)+1);
}
}
target.append(String.valueOf(temp));
}
return target.toString();
}
将一个字符串中字母替换为下一个字母
最新推荐文章于 2021-02-27 12:22:28 发布