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

Replacing string character

Hi

How can I replace all occurrences of a character in a string to another
character?

Thanks

Regards
Jul 10 '06 #1
3 1474
John wrote:
Hi

How can I replace all occurrences of a character in a string to another
character?

Thanks

Regards

Use the .Replace method of the string
..Replace("char that will be replaced","char to replace original char")

Dim temp as string = "ThisStringIsATest"
Dim result as string = temp.Replace("T","$")
'Replaces every occurence of "T" with "$"
Jul 10 '06 #2
Hi,

It may sound silly, but...

Try the string's Replace method. Example:

Buffer = Buffer.Replace(comecharsequence, someothercharsequence)

Dick
--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
Jul 10 '06 #3
"John" <Jo**@nospam.infovis.co.ukschrieb:
How can I replace all occurrences of a character in a string to another
character?
'System.String.Replace', 'Microsoft.VisualBasic.Strings.Replace',
'System.Text.RegularExpressions.Regex.Replace'.

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

Jul 10 '06 #4

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

Similar topics

10
by: Xah Lee | last post by:
i have a bunch of java files that has spaced-out formatting that i want to get rid of. I want to replace two end of line characters by one end of line characters. The files in question is unix, and...
4
by: C# Learner | last post by:
What's the "standard" way of replacing a character in a string? Obviously, I can't say "myString = character;" because strings are immutable... So what would be the "standard" way of doing this?...
11
by: Dimitris Georgakopuolos | last post by:
Hello, I have a text file that I load up to a string. The text includes certain expression like {firstName} or {userName} that I want to match and then replace with a new expression. However,...
5
by: Jim Lawton | last post by:
Hello group, I'm not very experienced in C#, but I can't find any example of this (common) programming problem. I have a string which contains a repeated substring - lets say it's like :- ...
7
by: VMI | last post by:
If I have the string "Héllo", how can I replace char (é) with an 'e'? I cannot use the String.Replace() fuction. It has to be by replacing one char with another. Thanks.
12
by: anonymous | last post by:
Hello, I need to replace this char  with another char. However I am not able to acieve this. I tried this but it doesnt work: str = str.Replace(chr(asc(194)), "") Can somebody help ?
12
by: Adam J. Schaff | last post by:
I am writing a quick program to edit a binary file that contains file paths (amongst other things). If I look at the files in notepad, they look like: ...
2
by: Alain | last post by:
Hi, I am working on a project where I need to convert international characters with acii values. Like André -> andre and Björn -> bjorn. How can I do this without replacing every single...
2
by: RJSF | last post by:
Hi, I have problem, where I need to replace the 8th character in a varchar string eg 002556-108823-AN-02 ie I need to change the 1 to 3. (and 2s to 4s in other strings eg 040598-20066-AN-02) ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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: 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)...
0
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....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.