StringBuilder substring

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Substring returns a given string from a string. Is there an equivalent way to
get a substring from a StringBuilder?
 
System.Text.StringBuilder ToString Method has two overloads one has no
parameter and the other one is the one that u are looking for.....

public System.String ToString ( System.Int32 startIndex , System.Int32
length )
 
That's not quite what I needed. I need to do the following,

StringBuilder sb1= new StringBuilder("0123456789")
StringBuilder sb2= new StringBuilder("old info")

sb2= sb1(0,4) //wrong

Giving sb2 equal to "0123"

Of course the line above marked wrong is wrong. So how would I do this? I
need the wrong line to clear out the old info and put in the first four
character from the other stringbuilder object.
 
Back
Top