Close though… It should just be [[ Target.text.slice(Target.text.indexOf(’$’)) ]]
To demonstrate this, I updated my .rp file to show what the prices are when they get removed, and added a button to restore the prices.
slice text to remove prices.rp (57.5 KB)
The way string slice() works is there are two arguments, a beginning position to start the slice, and an ending position to stop the slice. The first is required, the second is optional. If there is no second argument then the end of the string is used–so the returned slice will contain everything up to and including the last character in the string. Keep in mind strings start at 0 (zero), so in your username, “BNARob” the position (or in javascript lingo, the index ) of ‘B’ is 0.
- If I wanted to get only the first 3 chars from your username I would use
string.slice(0, 3)
- If I wanted to omit the first 3 chars, I would use
string.slice(3)
- If I wanted the middle 2 chars, I would use
string.slice(2, 4)
Another cool thing about slice() is it can slice from the end of the string, working its way backward through the string. To do this, just use negative values in the arguments.
- If I wanted the last 3 chars (and I don’t know or care how long the whole string might be) then I would use
string.slice(-3)
You can find out more details here: