chitika

Sunday, September 11, 2011

vb: how to replace, delete / remove character in string?

This site provides users with the information about vb, visual basic, vb6, replace character in string, remove character in string, how to replace character in string, how to delete character in string, and more.

If you think that this site is helpful, please recommend your friends to visit our site.

How to replace character in a string?

The following is the code for how to replace character in a string. It is very simple. You can just use the Replace function:

1. Repace character in a string


--------------------------------------------------------------------------------
dim s as string

s = "This is - what he said"
s = replace(s, "-", "*")

"s" shows "This is * what he said"
--------------------------------------------------------------------------------

2. Remove / delete character in a string

--------------------------------------------------------------------------------
dim s as string

s = "This is - what he said"
s = replace(s, "-", "")

"s" shows "This is what he said"
--------------------------------------------------------------------------------

Note:
You can also replace more than one characters in a string as follows:


--------------------------------------------------------------------------------
dim s as string

s = "This is - what he said"
s = replace(s, "what", "that")

"s" shows "This is - that he said"
--------------------------------------------------------------------------------

No comments:

Post a Comment

For other hundreds of computer repair tips, tricks, tweaks, guide, help, please go to


http://website.edusoftmax.com