I'm getting a compilation error in this code:
Code: Select all
const s = !"\9\32"
? s[0]
error 3: Expected End-of-Line, found '[' in '? s[0]'
Code: Select all
const s = !"\9\32"
? s[0]
error 3: Expected End-of-Line, found '[' in '? s[0]'
Operator [] (String index)
.....
Usage:
result = lhs [ rhs ]
.....
Parameters:
lhs : The string (a string reference, not a string returned as local copy).
rhs : A zero-based offset from the first character.
.....
Code: Select all
Function returnByval(Byref s As String) As String
Return s
End Function
Function returnByref(Byref s As String) Byref As String
Return s
End Function
Dim As String s = " "
'Print returnByval(s)[0] '' error 17: Syntax error
Print Asc(returnByval(s), 1)
Print
Print returnByref(s)[0]
Print Asc(returnByref(s), 1)
Sleep
The explanation in the help for this case is not very clear. But after you explained, it is now clear.a string reference, not a string returned as local copy
Operator [] (String index)
.....
Usage:
result = lhs [ rhs ]
.....
Parameters:
lhs : The string (a string reference, not a string returned as local copy)
lhs : The string variable or a string reference (not for example a string returned as a local copy).
rhs : A zero-based offset from the first character.
.....
Maybe you need to write that constants are not supported for the indexing operation?lhs : The string variable or a string reference (not for example a string returned as a local copy).
Operator [] (String index)
.....
Usage:
result = lhs [ rhs ]
.....
Parameters:
lhs : The string (a string reference, not a string returned as local copy)
lhs : The string variable or a string reference (not for example a constant or a string returned as a local copy).
rhs : A zero-based offset from the first character.
.....
Ok! Thanks!New update: