BIS fnc trimString: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
m (Some wiki formatting)
 
(38 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|= Comments
|game1= arma3
____________________________________________________________________________________________
|version1= 1.00


| arma3 |= Game name
|gr1= Strings


|1.00|= Game version
|descr= Get a substring out of the string.
____________________________________________________________________________________________
{{Feature|arma3|Use [[select#Alternative Syntax 3|select]] instead.}}


| <pre>/*
|s1= [someText, beginning, length] call [[BIS_fnc_trimString]]


Description:
|p1= someText: [[String]] - source string
Get a substring out of the string.


Parameter(s):
|p2= beginning: [[Number]] (Optional, default 0) - start index; indexing starts at 0
1: STRING - source string


2: NUMBER (optional, default 0) - start index;
|p3= length: [[Number]] (Optional, default end of string) - end index. A negative number means X chars ''from the string end''
  * indexing starts at 0


3: NUMBER (optional, default end of string) - end index
|r1= [[String]]
  * negative number means -X chars from the string end


Returns:
|x1= <sqf>["dreaded_is_the_man", 0, 6] call BIS_fnc_trimString; // will return "dreaded"</sqf>
STRING
*/


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
|x2= <sqf>["dreaded_is_the_man", 15] call BIS_fnc_trimString; // will return "man"</sqf>
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_trimString]]; --> |= Syntax
|x3= <sqf>["dreaded_is_the_man"] call BIS_fnc_trimString; // will return "dreaded_is_the_man"</sqf>


|p1= |= Parameter 1
|seealso= [[select]]
 
}}
| |= Return value
____________________________________________________________________________________________
 
|x1= <code>hint (["dreaded_is_the_man", 0, 6] call BIS_fnc_trimString);</code>This will show a hint with "dreaded" |=
|x1= <code>hint (["dreaded_is_the_man", 15, -3] call BIS_fnc_trimString);</code>This will show a hint with "man" |=
____________________________________________________________________________________________


| |= See also
{{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'''.
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Function Group: Strings|{{uc:trimString}}]]
[[Category:Functions|{{uc:trimString}}]]
[[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.