473,394 Members | 1,869 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,394 software developers and data experts.

StringBuilder.Replace Problem

Wieso wird beim folgenden Code nicht das Ergebnis ...drei Schwe...
geliefert? Startindex 5 statt 6 ändert auch nichts am Ergebnis.

Dim sb As New System.Text.StringBuilder("habe zwei Schweine und zwei
Hühner")
sb.Replace("zwei", "drei", 6, 1)
MsgBox(sb.ToString)
Danke Peter
Jan 5 '07 #1
2 1311

"Peter Gast" <pe********@tiscali.dewrote in message
news:en**********@online.de...
Wieso wird beim folgenden Code nicht das Ergebnis ...drei Schwe...
geliefert? Startindex 5 statt 6 ändert auch nichts am Ergebnis.

Dim sb As New System.Text.StringBuilder("habe zwei Schweine und zwei
Hühner")
sb.Replace("zwei", "drei", 6, 1)
MsgBox(sb.ToString)
Danke Peter
Perhaps this article will help:

http://msdn2.microsoft.com/en-us/library/y1bxd041.aspx

Above, change sb.Replace("zwei", "drei", 6, 1)
to sb.Replace("zwei", "drei", 5, 4) and it works.
Jan 5 '07 #2
"Peter Gast" <pe********@tiscali.deschrieb:
Wieso wird beim folgenden Code nicht das Ergebnis ...drei Schwe...
geliefert? Startindex 5 statt 6 ändert auch nichts am Ergebnis.

In addition to the other replies, note that this newsgroup targets the
English language. The German group's name is
"microsoft.public.de.german.entwickler.dotnet. vb".

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Jan 5 '07 #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: I am Sam | last post by:
Ok I don't know what is the problem with my code But I am trying to build a newsletter that gathers parameters from 3 textbox controls and a Listbox control. The form then queries the event table...
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...
23
by: J Jones | last post by:
I need to plug values into a condition like: ((E <= 100 And E > 79) And (F <= 59 And F > 39)) Or ((E <= 79 And E > 59) And (F <= 39 And F > 19)) Or ((E <= 59 And E > 39) And (F <= 19 And F >...
4
by: Cor | last post by:
Hi Newsgroup, I have given an answer in this newsgroup about a "Replace". There came an answer on that I did not understand, so I have done some tests. I got the idea that someone said,...
7
by: Larry Bird | last post by:
I want to use the "replace" in the string builder class. I've imported the "system.text.stringbuilder" class into my project. However, I don't see the method call for...
8
by: Guy | last post by:
Hi, I'm trying to run this code : strFileContentsHTML.Replace(vbLf, "<br>") strFileContentsHTML.Replace(vbCrLf, "<br>") strFileContentsHTML.Replace(vbCr, "<br>") It doesn't replace newline...
8
by: Laser Lu | last post by:
Sometimes, I need to do some time-consuming operations based on whether a specific keyword was contained in a lengthy string. Then, for a better performance, I wrapped that lengthy string into a...
8
by: Egghead | last post by:
Hi all, A very weird problem here. The toString method does not convert the whole StringBuilder elements. I find out it is because there are a series of this " " inside the stringbuilder....
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.