469,282 Members | 2,034 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

vb.net remove method

Hi,

I'm trying to use the remove method on a string but it doesnt seem to change
it.

name.remove(instr(name," ")-1,1)

If name = bon jovi, I would like bonjovi but I get bon jovi in the msgbox to
display it. I thought it suppose to remove the character space?

Am I doing something wrong?

thanks,
Will
Jul 21 '05 #1
4 10180
Are you assigning the answer to anything?

name = name.remove(instr(name," ")-1,1)

Chris

"wk6pack" <wk***@sd61.bc.ca> wrote in message
news:Oo**************@tk2msftngp13.phx.gbl...
Hi,

I'm trying to use the remove method on a string but it doesnt seem to
change
it.

name.remove(instr(name," ")-1,1)

If name = bon jovi, I would like bonjovi but I get bon jovi in the msgbox
to
display it. I thought it suppose to remove the character space?

Am I doing something wrong?

thanks,
Will

Jul 21 '05 #2
thanks Chris. My bad. I assumed it would place it back into name. Not
enough sleep.

thanks again.
Will

"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com> wrote
in message news:O5**************@TK2MSFTNGP09.phx.gbl...
Are you assigning the answer to anything?

name = name.remove(instr(name," ")-1,1)

Chris

"wk6pack" <wk***@sd61.bc.ca> wrote in message
news:Oo**************@tk2msftngp13.phx.gbl...
Hi,

I'm trying to use the remove method on a string but it doesnt seem to
change
it.

name.remove(instr(name," ")-1,1)

If name = bon jovi, I would like bonjovi but I get bon jovi in the msgbox to
display it. I thought it suppose to remove the character space?

Am I doing something wrong?

thanks,
Will


Jul 21 '05 #3
Remove + Instr will only remove one occurance. How about using Replace
instead of Remove/InStr?

name = name.Replace(" ", String.Empty);

That's assuming you'd want "Jon Bon Jovi" to become "JonBonJovi" rather than
"JonBon Jovi"

"wk6pack" <wk***@sd61.bc.ca> wrote in message
news:Oo**************@tk2msftngp13.phx.gbl...
Hi,

I'm trying to use the remove method on a string but it doesnt seem to
change
it.

name.remove(instr(name," ")-1,1)

If name = bon jovi, I would like bonjovi but I get bon jovi in the msgbox
to
display it. I thought it suppose to remove the character space?

Am I doing something wrong?

thanks,
Will

Jul 21 '05 #4
That'll be easier. Thanks.

Will
"Sean Hederman" <us***@blogentry.com> wrote in message
news:cv**********@ctb-nnrp2.saix.net...
Remove + Instr will only remove one occurance. How about using Replace
instead of Remove/InStr?

name = name.Replace(" ", String.Empty);

That's assuming you'd want "Jon Bon Jovi" to become "JonBonJovi" rather than "JonBon Jovi"

"wk6pack" <wk***@sd61.bc.ca> wrote in message
news:Oo**************@tk2msftngp13.phx.gbl...
Hi,

I'm trying to use the remove method on a string but it doesnt seem to
change
it.

name.remove(instr(name," ")-1,1)

If name = bon jovi, I would like bonjovi but I get bon jovi in the msgbox to
display it. I thought it suppose to remove the character space?

Am I doing something wrong?

thanks,
Will


Jul 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Sam Collett | last post: by
9 posts views Thread by Ken | last post: by
6 posts views Thread by tshad | last post: by
11 posts views Thread by Richard Maher | last post: by
2 posts views Thread by Nathan Sokalski | last post: by
10 posts views Thread by Tony Johansson | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.