BIS fnc trimString: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Arguments in MP|Multiplayer Arguments( \("local" or "global"\))?|Effects|Execution|Effects? in MP|Multiplayer Effects(...)
m (Some wiki formatting)
 
(20 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Function| arma3|1.00|gr1 = Strings| Get a substring out of the string.| [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''| [[String]]|x1= <code>["dreaded_is_the_man", 0, 6] [[call]] [[BIS_fnc_trimString]]; {{codecomment|// will return "dreaded"}}</code>|x2= <code>["dreaded_is_the_man", 15] [[call]] [[BIS_fnc_trimString]]; {{codecomment|// will return "man"}}</code>|x3= <code>["dreaded_is_the_man"] [[call]] [[BIS_fnc_trimString]]; {{codecomment|// will return "dreaded_is_the_man"}}</code>|}}
{{RV|type=function


<h3 style="display:none">Notes</h3>
|game1= arma3
<!-- CONTINUE Notes -->
|version1= 1.00


<dl class="command_description">
|gr1= Strings
<dd class="notedate">Posted on August 24, 2017 - 15:45 (UTC)
<dt class="note">[[User:R3vo|R3vo]]
<dd class="note">
<code>"test" [[select]] [0,4];</code>
Result: '''0.0007 ms'''<br><br>


<code>["test",0,4] [[call]] [[BIS_fnc_trimString]];</code>
|descr= Get a substring out of the string.
Result: '''0.013 ms'''<br><br>
{{Feature|arma3|Use [[select#Alternative Syntax 3|select]] instead.}}


The first method is about '''18 times faster'''.
|s1= [someText, beginning, length] call [[BIS_fnc_trimString]]
</dl>
 
<!-- DISCONTINUE Notes -->
|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>


[[Category:Functions|{{uc:trimString}}]]
The first method is about '''18 times faster'''.
[[Category:{{Name|arma3}}: Functions|{{uc:trimString}}]]
}}

Latest revision as of 23: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.