View Single Post
Old 12-26-2008, 11:04 AM   #3 (permalink)
Mideon
Forum Novice
 
Mideon's Avatar
 
Join Date: May 2005
Location: Canada
Age: 26
Posts: 684
Send a message via MSN to Mideon
Default

Strings are also like "arrays" of "char" type data.

So consider string temp = "blah";

temp[0] (this value is b)
temp[1] (this value is l)
etc.

So what you could do is...

Code:
foreach(char c in temp)
{
    if(c == ' ') //if char is whitespace
        c = '_'; //replace with underscore;
}
Something to this effect should work.

But there also should be many Methods in the String class that could help with this as well. Google C# string manipulation tutorial and you should find dozens of links....I wish I knew the methods, but I've not done much string manipulation in a long time.

Hope that helps and merry xmas if you celebrate.
__________________
tleauo.com -- An Ultima Online Roleplaying Environment
Mideon is offline   Reply With Quote