Re: how to insert space in a string
- From: KC <kenchengtk@xxxxxxxxx>
- Date: Fri, 31 Oct 2008 08:32:00 -0700 (PDT)
On 10月31日, 下午11時13分, GArlington <garling...@xxxxxxxxxxxxx> wrote:
On Oct 31, 2:52 pm, KC <kenchen...@xxxxxxxxx> wrote:
On 10月31日, 下午10時42分, KC <kenchen...@xxxxxxxxx> wrote:
Hi all,
I m new in Java, Im not know well about Java syntax, for now, I need
to reform a string var, find out the newline char ( "\r\n" ) and
replace it with specify no. of Space char ( " " ), in order to get the
result string char with 50 * (no.of line) char,
example as blow:
" The group you are posting to is a Usenet group.\r\nMessages posted
to this group\r\nWill make your email address\r\n"
orginal sting change it into
"The group you are posting to is a Usenet group. " +
"Messages posted to this group
" +
"Will make your email
address "
for each line contains exactly 50 char
Thx all for attention,
"The group you are posting to is a Usenet group.\r\nMessages posted to
this group\r\nWill make your email address\r\n"
for 1st line: "The group you are posting to is a Usenet group.\r\n"
contains 46 char, that means insert 4 more space char reform to
exactly 50 chat string
"The group you are posting to is a Usenet group. "
for 2nd line: "Messages posted to this group\r\n"
contains 28 char, that means insert 22 more space char reform to
exactly 50 chat string
"The group you are posting to is a Usenet group.
"
Not sure what (and WHY) you are trying to do, but see:http://www.google.co.uk/search?q=java+string&ie=utf-8&oe=utf-8&aq=t&r...
thx for reply, I have try thr string.function(s), like .compare... but
not sure which one is capable for this case, if for vb syntax, I know
how to findout the exact postion of newline char in the string var,
but java, I have no idea
.
- Follow-Ups:
- Re: how to insert space in a string
- From: Donkey Hottie
- Re: how to insert space in a string
- References:
- how to insert space in a string
- From: KC
- Re: how to insert space in a string
- From: KC
- Re: how to insert space in a string
- From: GArlington
- how to insert space in a string
- Prev by Date: Re: Possible bug in Calendar
- Next by Date: Re: How to set the compiler to handle thousand loops ?
- Previous by thread: Re: how to insert space in a string
- Next by thread: Re: how to insert space in a string
- Index(es):
Relevant Pages
|