473,327 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

How to reset a StringBuilder?

I've got stuff in my StringBuilder (System.Text) and I need to clear it all
out. How do I do that?
Nov 18 '05 #1
2 5307
Dim sb as new system.text.stringbuilder
sb.append("foo")
sb = new system.text.stringbuilder
sb.append("bar")

? sb.tostring
bar

There is also the Remove method.

HTH,
Greg
"ESPN Lover" <es**@lover.com> wrote in message
news:eV**************@tk2msftngp13.phx.gbl...
I've got stuff in my StringBuilder (System.Text) and I need to clear it
all
out. How do I do that?

Nov 18 '05 #2
Thanks! :-)

"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:uG**************@TK2MSFTNGP14.phx.gbl...
Dim sb as new system.text.stringbuilder
sb.append("foo")
sb = new system.text.stringbuilder
sb.append("bar")

? sb.tostring
bar

There is also the Remove method.

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

37
by: Kevin C | last post by:
Quick Question: StringBuilder is obviously more efficient dealing with string concatenations than the old '+=' method... however, in dealing with relatively large string concatenations (ie,...
20
by: Alvin Bruney | last post by:
On the advice of a user, I've timed stringbuilder v string. Here are the results. Here are the numbers: Total # queries 3747 Time in Milliseconds StringBuilder: String...
0
by: Mo | last post by:
I am having problem with marshaling struct in C#. //the original C++ struct typedef struct _tagHHP_DECODE_MSG { DWORD dwStructSize; // Size of decode structure. TCHAR ...
1
by: Lee Price | last post by:
Hi all, I have a bound datagrid which is filled with data and displayed.Now on the click of a button I need to refill the datagrid with new data but the problem is the datagrid mixes up the new...
9
by: Peter Row | last post by:
Hi, I know this has been asked before, but reading the threads it is still not entirely clear. Deciding which .Replace( ) to use when. Typically if I create a string in a loop I always use a...
12
by: Richard Lewis Haggard | last post by:
I thought that the whole point of StringBuilder was that it was supposed to be a faster way of building strings than string. However, I just put together a simple little application to do a...
2
by: m00nm0nkey | last post by:
Ok well i thought i'd try a different approach, so what I'm now trying is appending 50,000 lines from the collection to a stringbuilder, and then writing that entire stringbuilder to a file. ...
5
by: pantagruel | last post by:
Hi, It is generally stated that stringbuilder should be used instead of just concatenating strings with the plus operator. That's fine enough what I'm wondering in cases I have: String S =...
34
by: raylopez99 | last post by:
StringBuilder better and faster than string for adding many strings. Look at the below. It's amazing how much faster StringBuilder is than string. The last loop below is telling: for adding...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.