Print a string value from its character position

is there a possible way to print the string value from the position I want to call?
for example the script reads the value from a string bool value.

the String is special to the user for configuration and reading,
here is the example of my string format: 00-007-000

is there a way to read/print the digit 7 from the bool value?
I’ve tried multiple solutions but they aren’t what I’m looking for.

1 Like

Use string.sub

For example, the 7 is the 6th position of the string, so use string.sub("00-007-000",6,6)]

I also made a topic like this back in January when I was still learning how to script:


works, thanks for the solution.

You can also click the pencil button and move this topic into #help-and-feedback:scripting-support to mark my post as the solution.

1 Like