BIS fnc trimString: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<code>([^<]*)\[\[([a-zA-Z][a-zA-Z0-9_]+)\]\]([^<]*) *<\/code>" to "<code>$1$2$3</code>")
m (Some wiki formatting)
 
(4 intermediate revisions by the same user not shown)
Line 19: Line 19:
|r1= [[String]]
|r1= [[String]]


|x1= <code>["dreaded_is_the_man", 0, 6] call BIS_fnc_trimString; {{cc|will return "dreaded"}}</code>
|x1= <sqf>["dreaded_is_the_man", 0, 6] call BIS_fnc_trimString; // will return "dreaded"</sqf>


|x2= <code>["dreaded_is_the_man", 15] call BIS_fnc_trimString; {{cc|will return "man"}}</code>
|x2= <sqf>["dreaded_is_the_man", 15] call BIS_fnc_trimString; // will return "man"</sqf>


|x3= <code>["dreaded_is_the_man"] call BIS_fnc_trimString; {{cc|will return "dreaded_is_the_man"}}</code>
|x3= <sqf>["dreaded_is_the_man"] call BIS_fnc_trimString; // will return "dreaded_is_the_man"</sqf>


|seealso=
|seealso= [[select]]
}}
}}


<dl class="command_description">
{{Note
 
|user= R3vo
<dt></dt>
|timestamp= 20170824154500
<dd class="notedate">Posted on August 24, 2017 - 15:45 (UTC)</dd>
|text= <sqf>
<dt class="note">[[User:R3vo|R3vo]]</dt>
"test" select [0, 4]; // 0.0007 ms
<dd class="note">
["test", 0, 4] call BIS_fnc_trimString; // 0.013 ms
<code>"test" select [0,4]; {{cc|0.0007 ms}}
</sqf>
["test",0,4] call BIS_fnc_trimString; {{cc|0.013 ms}}</code>


The first method is about '''18 times faster'''.
The first method is about '''18 times faster'''.
</dd>
}}
 
</dl>

Latest revision as of 22:38, 13 May 2023

Hover & click on the images for description

Description

Description:
Get a substring out of the string.
Arma 3
Use select instead.
Execution:
call
Groups:
Strings

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:
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
R3vo - c
Posted on Aug 24, 2017 - 15:45 (UTC)
"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.