BIS fnc trimString: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "{{Function" to "{{RV|type=function ") |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
(18 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{RV|type=function | {{RV|type=function | ||
|game1= arma3 | |||
|version1= 1.00 | |||
|gr1= Strings | |||
|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]] | |||
</ | |||
< | |p1= someText: [[String]] - source string | ||
|p2= beginning: [[Number]] (Optional, default 0) - start index; indexing starts at 0 | |||
|p3= length: [[Number]] (Optional, default end of string) - end index. A negative number means X chars ''from the string end'' | |||
|r1= [[String]] | |||
|x1= <sqf>["dreaded_is_the_man", 0, 6] call BIS_fnc_trimString; // will return "dreaded"</sqf> | |||
|x2= <sqf>["dreaded_is_the_man", 15] call BIS_fnc_trimString; // will return "man"</sqf> | |||
|x3= <sqf>["dreaded_is_the_man"] call BIS_fnc_trimString; // will return "dreaded_is_the_man"</sqf> | |||
|seealso= [[select]] | |||
}} | |||
{{Note | |||
|user= R3vo | |||
|timestamp= 20170824154500 | |||
|text= <sqf> | |||
"test" select [0, 4]; // 0.0007 ms | |||
["test", 0, 4] call BIS_fnc_trimString; // 0.013 ms | |||
</sqf> | |||
The first method is about '''18 times faster'''. | |||
}} |
Latest revision as of 23:38, 13 May 2023
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:
- Example 2:
- Example 3:
Additional Information
- See also:
- select
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 Aug 24, 2017 - 15:45 (UTC)
- The first method is about 18 times faster.