【在 m******t 的大作中提到】 : : Hmmm, why not something that actually justifies our salary? /grin... : StringBuilder sb = new StringBuilder("\u0020"); : for (int i = 0; i < 3; i++) { : sb.append(sb.toString()); : } : String rawString = sb.toString(); : String truncatedString = rawString.substring(0, (int)Math.pow(2, 3) - 3); : String resultString = truncatedString.replace('\u0020', '\u0030'); : System.out.println(resultString);
m*t
6 楼
Oh, that's extremely important in terms of keeping the program 100% unicode conform, and hence localizable. StringBuilder is another critical part, precisely because it's part of J2SE 5.0, which represents the cutting edge technology we always try to sell, er, I mean, provide value with, to our customers. Besides, writing code like that is the only fun I have everyday, working with those other software engineers who don't have any sense of humor whatsoever... ;-)
i see. i agree with you in the unicode part. but i won't use StringBuilder except in the circumstances where this class is obviously better than StringBuffer. btw, you just come to show that you are not a boring java engineer? lol
【在 m******t 的大作中提到】 : : Oh, that's extremely important in terms of keeping the program : 100% unicode conform, and hence localizable. StringBuilder : is another critical part, precisely because it's part of : J2SE 5.0, which represents the cutting edge technology we : always try to sell, er, I mean, provide value with, to our : customers. : Besides, writing code like that is the only fun I have : everyday, working with those other software engineers who : don't have any sense of humor whatsoever... ;-)