BIS fnc trimString: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Page filling)
Line 8: Line 8:
____________________________________________________________________________________________
____________________________________________________________________________________________


| <pre>/*
| Get a substring out of the string. |= Description
____________________________________________________________________________________________


Description:
| [someText, beginning, length] call [[BIS_fnc_trimString]] |= Syntax
Get a substring out of the string.


Parameter(s):
|p1= someText: [[String]] - source string |= Parameter 1
1: STRING - source string


2: NUMBER (optional, default 0) - start index;
|p2= beginning: [[Number]] (Optional, default 0) - start index; indexing starts at 0 |= Parameter 2
  * indexing starts at 0


3: NUMBER (optional, default end of string) - end index
|p3= length: [[Number]] (Optional, default end of string) - end index. A negative number means X chars ''from the string end'' |= Parameter 3
  * negative number means -X chars from the string end


Returns:
| [[String]] |= Return value
STRING
*/
 
</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
____________________________________________________________________________________________
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_trimString]]; --> |= Syntax
|x1= <code>["dreaded_is_the_man", 0, 6] [[call]] [[BIS_fnc_trimString]]; {{codecomment|// will return "dreaded"}}</code> |= Example 1
 
|p1= |= Parameter 1


| |= Return value
|x2= <code>["dreaded_is_the_man", 15] [[call]] [[BIS_fnc_trimString]]; {{codecomment|// will return "man"}}</code> |= Example 2
____________________________________________________________________________________________


|x1= <code>hint (["dreaded_is_the_man", 0, 6] call BIS_fnc_trimString);</code>This will show a hint with "dreaded" |=
|x3= <code>["dreaded_is_the_man"] [[call]] [[BIS_fnc_trimString]]; {{codecomment|// will return "dreaded_is_the_man"}}</code> |= Example 3
|x2= <code>hint (["dreaded_is_the_man", 15] call BIS_fnc_trimString);</code>This will show a hint with "man" |=
____________________________________________________________________________________________
____________________________________________________________________________________________


Line 45: Line 34:


<h3 style="display:none">Notes</h3>
<h3 style="display:none">Notes</h3>
<!-- CONTINUE Notes -->
<dl class="command_description">
<dl class="command_description">
<!-- Note Section BEGIN -->
<dd class="notedate">Posted on August 24, 2017 - 15:45 (UTC)
<dt class="note">[[User:Revo|Revo]]
<dd class="note">
<code>"test" [[select]] [0,4];</code>
Result: '''0.0007 ms'''<br><br>


<!-- Note Section END -->
<code>["test",0,4] [[call]] [[BIS_fnc_trimString]];</code>
Result: '''0.013 ms'''<br><br>
 
The first method is about '''18 times faster'''.
</dl>
</dl>
<!-- DISCONTINUE Notes -->


<h3 style="display:none">Bottom Section</h3>
<h3 style="display:none">Bottom Section</h3>
Line 55: Line 54:
[[Category:Functions|{{uc:trimString}}]]
[[Category:Functions|{{uc:trimString}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:trimString}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:trimString}}]]
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on August 24, 2017 - 15:45 (UTC)</dd>
<dt class="note">[[User:Revo|Revo]]</dt>
<dd class="note">
Result: '''0.0007 ms'''<br><br>
Code: "test" [[select]] [0,4]<br><br>
Result: '''0.013 ms'''<br><br>
Code:<br>
["test",0,4] [[call]] '''BIS_fnc_trimString'''<br>
'''The first method is about x18 times faster.'''
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Revision as of 01:47, 27 March 2018


Hover & click on the images for description

Description

Description:
Get a substring out of the string.
Execution:
call
Groups:
Uncategorised

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

Notes

Posted on August 24, 2017 - 15:45 (UTC)
Revo
"test" select [0,4]; Result: 0.0007 ms

["test",0,4] call BIS_fnc_trimString; Result: 0.013 ms

The first method is about 18 times faster.

Bottom Section