View Single Post
Old 12-27-2008, 01:13 PM   #4 (permalink)
Jeff
ConnectUO Creator
 
Join Date: Jan 2004
Age: 29
Posts: 6,075
Default

Quote:
Originally Posted by Mideon View Post
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(' ', '_');
__________________
Jeff Boulanger
ConnectUO - Creator/Core Developer
ConnectUO Swag/Merchandise

Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO
Jeff is offline   Reply With Quote