In using such as .Right(2), is one supposed to be able to do such as:
("0" + hex(c.Red)).Right(2)
which is what the complier seems to be saying to the OP in his posted code. Trouble is, if I try what I’ve put in the post, all I get is “Syntax Error”. Unless one can do this, either the OP lives with his Warning, or he uses a tmp string as I said upthread.
Not very intuitive I know, but we work with what we’re given. Even the docs for Hex don’t show this and show the API 1 route.[/quote]
A Text literal, or string literal, isnt a string hence why you need that ugly dance
.Right is an extension on String - which doesnt work for a string literal
Would be nice if it did as the API 1 syntax is simpler for some things because of this
<https://xojo.com/issue/56629>
I’ve not seen an answer to that yet.[/quote]
Because thats not how the compiler works ?
I dont think there’s anything more sophisticated than that.
It sure would be handy though esp with the API 2 changes
When I want to check that all characters in a TextField are number, I loop on each character doing “0123456789”.IndexOf(ThisChar) but I can’t, I have to define a string (constant or variable).
I wax able to do it with Instr(“0123456789”, ThisChar)
(yes I know there is TextField.Mask, but it can be a value I read in a text file or etc. ).