Connecting Tech Pros Worldwide Help | Site Map

Manipulating at lines of StringBuilder

BobRoyAce
Guest
 
Posts: n/a
#1: Jan 18 '08
1) I have a variable...Dim sb as StringBuilder.
2) I assign a bunch of lines to sb.
3) I can get all the text back as a string with sb.ToString.

My question is how can I programatically update the various lines in
sb? For example, let's say that I want to add 2 spaces to the
beginning of every line in sb. Is there a way to do this easily? I
don't see a way to even read the individual lines in sb, never mind
add text to beginning of each.
Jack Jackson
Guest
 
Posts: n/a
#2: Jan 18 '08

re: Manipulating at lines of StringBuilder


On Thu, 17 Jan 2008 19:42:53 -0800 (PST), BobRoyAce
<broy@omegasoftwareinc.comwrote:
Quote:
>1) I have a variable...Dim sb as StringBuilder.
>2) I assign a bunch of lines to sb.
>3) I can get all the text back as a string with sb.ToString.
>
>My question is how can I programatically update the various lines in
>sb? For example, let's say that I want to add 2 spaces to the
>beginning of every line in sb. Is there a way to do this easily? I
>don't see a way to even read the individual lines in sb, never mind
>add text to beginning of each.
If you are doing a lot of modifications you might be better off using
a List(Of String) with each line an entry in the list. That makes
modifying entries very easy. When you are finished you can put the
entries in the list into a StringBuilder.
Closed Thread