Replacing string character

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

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

Thanks

Regards
 
John said:
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 "$"
 
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.
 
John said:
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'.
 
Back
Top