"Unexpected character" bug?
-
The code in red here is triggering an error,
"Unexpected character ' ' in source":The variable on which the error is occurring is declared on line 485,
then used on line 502, both without problem.The error itself does not relay what character is unexpected, as that field is blank (' ').
Ideas?
A bug? -
@VirtualVirgin What is
String()
on the line above? -
I tried retyping the lines and it came up red again.
Then I copy and pasted the same lines from the one just above, and now the error is gone:Perplexed!
-
@VirtualVirgin If you copied and pasted originally from somewhere outside of HISE then hidden characters may have been added - ChatGPT does this.
Still, what is
String()
? Is that a function you wrote?You can use
myString.contains()
instead ofindexOf
- It does the same thing in this case but more clearly shows the intention of the code.Another tip, use
isDefined()
instead of!= undefined
const test = 0; Console.print(test != undefined); // 0
const test = 0; Console.print(isDefined(test)); // 1
-
@d-healey I asked Gemini to edit a block I was working on but now I have rewritten that entire section so the String() is not being used at all. It was trying to convert the cellValue to a string, which was not necessary anyway.