
-----------------------------------
CWRules
Tue Apr 07, 2009 4:17 pm

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:

        open : data, "Data.txt", get
        get : data, pname1
        get : data, pname2
        get : data, gender
        get : data, birthday
        get : data, birthmon
        get : data, birthyr
        get : data, hometown : *
        get : data, country : *
        close : data

The last two variables are the ones causing the problem.

Mod Edit: Remember to use syntax tags! Thanks :) Code Here

-----------------------------------
DemonWasp
Tue Apr 07, 2009 5:36 pm

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:


var c : char := myString ( 12 )


-----------------------------------
CWRules
Tue Apr 07, 2009 9:04 pm

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)
