Removing Underscores from Strings
Author |
Message |
CWRules
|
Posted: 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:
Turing: | 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: | [syntax="turing"]Code Here[/syntax] |
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
DemonWasp
|
Posted: 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:
Turing: |
var c : char := myString ( 12 )
|
|
|
|
|
|
![](images/spacer.gif) |
CWRules
|
Posted: 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) |
|
|
|
|
![](images/spacer.gif) |
|
|