Quote:
Originally Posted by Mideon
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.
|
wow....
you should just use string.Replace
Code:
temp = temp.Replace(' ', '_');