Replace command not working
BlitzMax Forums/BlitzMax Beginners Area/Replace command not working
| ||
I can't get the Replace command working. Also the Replace method for a string doesn't seem to work. Print Replace$("This is a test to replace spaces", Chr(34), "") Local TestString$ = "This is a test to replace spaces" Print TestString.Replace(Chr(34), "") It just prints the exact same text, without replacing the space-chars with nothing (""). |
| ||
The ASCII for a space is 32 not 34. However it still does not appear to work. |
| ||
Doh, I feel sooooooo stupid right now. Just found out myself too (by looking into MSDN's ASCII table). It works now. Print Replace$("This is a test to replace spaces", Chr(32), "") Local TestString$ = "This is a test to replace spaces" Print TestString.Replace(Chr(32), "") |
| ||
I just realised why it didn't work for me; I assumed the replace method for a string actually modified the string which it does not. It simply returns the modified string. |