Computer Science Canada Removing Underscores from Strings |
Author: | CWRules [ Tue Apr 07, 2009 4:17 pm ] | ||||
Post subject: | Removing Underscores from Strings | ||||
I'm having a slight problem with my loading system. I have several strings with multiple words, and when I load them from the file they have underscores instead of spaces. eg. "Sutton West" becomes "Sutton_West" Is there a way around this? Thanks. (I have a feeling that this will be a very obvious and simple answer) The code as is:
The last two variables are the ones causing the problem. Mod Edit: Remember to use syntax tags! Thanks ![]()
|
Author: | DemonWasp [ Tue Apr 07, 2009 5:36 pm ] | ||
Post subject: | RE:Removing Underscores from Strings | ||
Iterate over the string, replacing every instance of the underscore character with the space character. Remember that you can read or set the value of a single character in a string by indexing it like an array:
|
Author: | CWRules [ Tue Apr 07, 2009 9:04 pm ] |
Post subject: | Re: Removing Underscores from Strings |
I don't quite get it. I see what you mean but don't see exactly how it would be done. Could you explain? Thanks. (Man, I feel stupid today) |