|
I am having a difficult time initializing an array of char to use in String.Trim member function in Unityscript. At a high level I am just trying to remove any trailing carriage returns from a string. This should be a no brainer but I have tried different methods to no avail - for example this - results in this error - Assets/Scripts/GameGUI.js(300,60): BCE0022: Cannot convert 'String[]' to 'char[]'. and this - var charsToTrim : char[] = new char[1]; charsToTrim[1] = '\n'; chatTextAreaString.Trim(charsToTrim); results in this error - Assets/Scripts/GameGUI.js(261,50): BCE0022: Cannot convert 'String' to 'char'. The root of the issue is that I need to understand the syntax and caveats of using different types of arrays in Unityscript and haven't found a comprehensive source for this. Any help with my immediate problem would be appreciated and if anyone has a source where I can read up on Unityscript array syntax would also be great.
(comments are locked)
|
|
Eric's explanation is far clearer than mine :)
Apr 10 '11 at 07:29 PM
Wibbs 1
Wow, thanks for the quick response Eric and Wibbs! This is what I was missing.
Apr 10 '11 at 07:57 PM
jrbailey1977
(comments are locked)
|
|
I think its got something to do with Javascript not liking character literals. Try:
instead.
(comments are locked)
|
