delete all spaces in vb string

Started by
1 comment, last by Draco5869 20 years, 8 months ago
How can i clear all of the spaces in a string so if i would go from "this is a string" to "thisisastring" Nub question, thanks ----------------------------------------------------------- Like a sponge!
-----------------------------------------------------------Like a sponge!
Advertisement
The easiest way to do it is to copy the string to another
string (array).

Loop the string through character by character, and compare them with '' '' (space), if it''s NOT space, copy the character, to the other string, and increment the counters.
if it IS space, just increment the first strings counter and keep going..
Or since you''re using VB, couldn''t you just do:

str = Replace(str, " ", ""

This topic is closed to new replies.

Advertisement