由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - a simple question
相关主题
请问StringBuffer的OutofMemory问题请教一题
Java StringBuilder myth debunked为什么我这个参数的内容存不下?
ArrayList vs Array, StringBuffer vs String, 大侠们给讲讲有Recusion is fucking magic!!
int --> String?初学者code请教 (大牛莫取笑)
这两个程序哪个更快?java多线程问题请教
Java练习题 3一个Java程序员的话(4)--续第一章
有什么办法高效的进行replaceAllJAVA中文TELNET MwTerm 1.000 Final
我自己编了个Java面试题jre classpath
相关话题的讨论汇总
话题: string话题: question话题: u0020话题: java
进入Java版参与讨论
1 (共1页)
l*r
发帖数: 34
1
A beginner's question:
how can I create a string of 5 0s in Java?
Thanx!
g*****g
发帖数: 34805
2
String a = "00000", that's it.

【在 l*r 的大作中提到】
: A beginner's question:
: how can I create a string of 5 0s in Java?
: Thanx!

m******t
发帖数: 2416
3

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);

【在 g*****g 的大作中提到】
: String a = "00000", that's it.
g*****g
发帖数: 34805
4
You should at least make a javabean to access your
precious String, using a System.out is not gonna
do the job.

【在 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);

t******c
发帖数: 348
5
靠StringBuilder是j2se1.5刚出来的,不适合多线程。
请问搞些\u0020 \u0030 换来换去 有什么意义?

【在 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
发帖数: 2416
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... ;-)

【在 t******c 的大作中提到】
: 靠StringBuilder是j2se1.5刚出来的,不适合多线程。
: 请问搞些\u0020 \u0030 换来换去 有什么意义?

t******c
发帖数: 348
7

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... ;-)

1 (共1页)
进入Java版参与讨论
相关主题
jre classpath这两个程序哪个更快?
Be clear about one thing firstJava练习题 3
求助Java Image Tools or API有什么办法高效的进行replaceAll
[转载] 有人在用NetBeans IDE么?我自己编了个Java面试题
请问StringBuffer的OutofMemory问题请教一题
Java StringBuilder myth debunked为什么我这个参数的内容存不下?
ArrayList vs Array, StringBuffer vs String, 大侠们给讲讲有Recusion is fucking magic!!
int --> String?初学者code请教 (大牛莫取笑)
相关话题的讨论汇总
话题: string话题: question话题: u0020话题: java