Re: how to insert space in a string
- From: KC <kenchengtk@xxxxxxxxx>
- Date: Fri, 31 Oct 2008 07:52:03 -0700 (PDT)
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.
"
.
- Follow-Ups:
- Re: how to insert space in a string
- From: GArlington
- Re: how to insert space in a string
- References:
- how to insert space in a string
- From: KC
- how to insert space in a string
- Prev by Date: how to insert space in a string
- Next by Date: Re: Adding same elements in an array.,
- Previous by thread: how to insert space in a string
- Next by thread: Re: how to insert space in a string
- Index(es):
Relevant Pages
|