Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Draco5869

delete all spaces in vb string

This topic is 5441 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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..

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Or since you''re using VB, couldn''t you just do:

str = Replace(str, " ", ""

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!