BIS fnc trimString: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "\|game([0-9])= *([^ ]+) * +\|version([0-9])= *([^ ]+) * " to "|game$1=$2 |version$3=$4 ") |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
Line 7: | Line 7: | ||
|descr= Get a substring out of the string. | |descr= Get a substring out of the string. | ||
{{Feature|arma3|Use [[select#Alternative Syntax 3|select]] instead.}} | |||
|s1= [someText, beginning, length] call [[BIS_fnc_trimString]] | |s1= [someText, beginning, length] call [[BIS_fnc_trimString]] | ||
Line 31: | Line 32: | ||
<dt class="note">[[User:R3vo|R3vo]]</dt> | <dt class="note">[[User:R3vo|R3vo]]</dt> | ||
<dd class="note"> | <dd class="note"> | ||
<code>"test" [[select]] [0,4]; | <code>"test" [[select]] [0,4]; {{cc|0.0007 ms}} | ||
["test",0,4] [[call]] [[BIS_fnc_trimString]]; {{cc|0.013 ms}}</code> | |||
The first method is about '''18 times faster'''. | |||
</dd> | |||
</dl> | </dl> |
Revision as of 10:18, 14 June 2021
Description
Syntax
- Syntax:
- [someText, beginning, length] call BIS_fnc_trimString
- Parameters:
- someText: String - source string
- beginning: Number (Optional, default 0) - start index; indexing starts at 0
- length: Number (Optional, default end of string) - end index. A negative number means X chars from the string end
- Return Value:
- String
Examples
- Example 1:
["dreaded_is_the_man", 0, 6] call BIS_fnc_trimString; // will return "dreaded"
- Example 2:
["dreaded_is_the_man", 15] call BIS_fnc_trimString; // will return "man"
- Example 3:
["dreaded_is_the_man"] call BIS_fnc_trimString; // will return "dreaded_is_the_man"
Additional Information
- See also:
- See also needed
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
- Posted on August 24, 2017 - 15:45 (UTC)
- R3vo
-
"test" select [0,4]; // 0.0007 ms ["test",0,4] call BIS_fnc_trimString; // 0.013 ms
The first method is about 18 times faster.