Page MenuHomeFeedback Tracker

implement scripting command "b:STRING select SCALAR"
New, WishlistPublic

Description

Allow usage of "select" scripting command with a string as first parameter.
Should return a string containing the selected character.
e.g.
"foobar" select 3
returns:
"b"

functionality should be available in the engine because
String select SCALAR
is just a shortcut for:
toString [toArray STRING select SCALAR]

Details

Legacy ID
476073962
Severity
None
Resolution
Open
Reproducibility
N/A
Category
Feature Request
Additional Information

there are some more scripting commands for arrays which could be useful for strings, too - count, set, ...

Event Timeline

Master85 edited Steps To Reproduce. (Show Details)Jul 7 2014, 2:48 PM
Master85 edited Additional Information. (Show Details)
Master85 set Category to Feature Request.
Master85 set Reproducibility to N/A.
Master85 set Severity to None.
Master85 set Resolution to Open.
Master85 set Legacy ID to 476073962.May 7 2016, 6:55 PM
Bohemia added a subscriber: AD2001.Jul 7 2014, 2:48 PM

IMO substring command would do what you want and more. Ive privately asked for it already, but no guarantees of course.

getting a substring command was the plan - was preparing a feature ticket for "b:ARRAY select ARRAY"
with a syntax similar to the extended slicing syntax of python

but I think extending the select command for usage with strings would be quite handy anyway - and the same syntax is available in o2script

This is what I had in mind. I pretty sure there has to be substring method in A3

strSubstr
STRING = STRING strSubstr ARRAY;
ARRAY - [start, stop]
Extracts the characters in a string between 'start' and 'stop', not including 'stop' itself.
"Hello" strSubstr [1,4]; ell
When only one param specified, substring is extracted from 'start' to end.
"Hello" strSubstr [2]; //llo