Home All Groups Group Topic Archive Search About

Clear spaces between tex

Author
4 Dec 2006 12:59 PM
Jan
Hallo,

How can i Clear empty spaces between text.
For example:

I've got the name "Justin Name" in a string and want to clear de spaces
between de names so i will get "JustinName".

What can i use to do that?

TIA Jan

Author
4 Dec 2006 1:10 PM
guy
use the VB 'Replace' function

newString = Replace(myString," ","")

hth

Guy
Show quoteHide quote
"Jan" wrote:

> Hallo,
>
> How can i Clear empty spaces between text.
> For example:
>
> I've got the name "Justin Name" in a string and want to clear de spaces
> between de names so i will get "JustinName".
>
> What can i use to do that?
>
> TIA Jan
>
Author
4 Dec 2006 1:56 PM
Fred
Try

Replace("Justin Name", " ", "")

Fred


Jan wrote:
Show quoteHide quote
> Hallo,
>
> How can i Clear empty spaces between text.
> For example:
>
> I've got the name "Justin Name" in a string and want to clear de spaces
> between de names so i will get "JustinName".
>
> What can i use to do that?
>
> TIA Jan
Author
4 Dec 2006 7:14 PM
Rad [Visual C# MVP]
On Mon, 4 Dec 2006 13:59:48 +0100, Jan wrote:

> Hallo,
>
> How can i Clear empty spaces between text.
> For example:
>
> I've got the name "Justin Name" in a string and want to clear de spaces
> between de names so i will get "JustinName".
>
> What can i use to do that?
>
> TIA Jan

You can also try this:

imports System.Text.RegularExpressions

newString = Regex.Replace(oldString,"\s+","")

This way has the added benefit that it also takes care of tabs