Normy Haddad
Normy Haddad

Reputation: 181

How to delete multiple characters from a string in livecode

I am trying to work with a string, and delete the last 2 characters. Normally the code would look like this:

delete char -1 to -2 of openprice

but that doesn't work, so I need to resort to doing this:

delete char -1 of openprice
delete char -1 of openprice

What is wrong here?

Upvotes: 2

Views: 303

Answers (1)

Scott Rossi
Scott Rossi

Reputation: 885

Try the reverse:

delete char -2 to -1 of openprice

The last character of a left-to-right string is -1, so the second to last would be -2, etc.

Upvotes: 2

Related Questions