java - Increase string value -
java question here: if have string "a", how can "add" value string, "b" , on? "a++"
string str = "abcde"; system.out.println(getincrementedstring(str));
output
bcdef
//this code give next char in unicode sequence
public static string getincrementedstring(string str){ stringbuilder sb = new stringbuilder(); for(char c:str.tochararray()){ sb.append(++c); } return sb.tostring(); }
Comments
Post a Comment