- Home /
Why does String.fromCharCode does not work?
I'm trying to remove a break line from a text. This is what i'm using:
var webData = download.data.Replace(String.fromCharCode(13),"");
but i get the error which says fromCharCode is not a member of String. what could possibly be wrong? thanks,
Answer by Eric5h5 · Oct 28, 2010 at 08:27 PM
There is no "fromCharCode" function in the String class. Everything in String is here. You can use "\n" for a linebreak character.
Thanks eric for the reply. I found what i was looking for. the link was very helpful. ok it is possible to address a character inside a string like this:
myCharacter = myString(positionOfCharacter:int);
And to remove all unnecessary spaces from a the beginning of a string it's so easy to use this function:
myString = myString.TrimStart();
regards.
Your answer
![](https://koobas.hobune.stream/wayback/20220613081213im_/https://answers.unity.com/themes/thub/images/avi.jpg)