BIS fnc filterString: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (1 revision)
m (Some wiki formatting)
 
(33 intermediate revisions by 4 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= Removes characters from a string based on the list of allowed characters.
____________________________________________________________________________________________


| <pre>/*
|s1= [text, allowedChars] call [[BIS_fnc_filterString]]


Description:
|p1= '''text:''': [[String]] - text to filter
Removes characters from a string based on the list of allowed characters.


Parameter(s):
|p2= '''allowedChars''': [[String]] - (Optional, default a..z, A..Z, 0..9, "_") allowed characters
_this select 0: STRING - Filtered text
_this select 1 (Optional): STRING - Filter (default: A-Z, a-z, 0-9 and "_")


Returns:
|r1= [[String]] - filtered text with only the allowed characters supplied in the filter.
STRING
*/


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
|x1= <sqf>["Player 1 @%!@$"] call BIS_fnc_filterString; // returns "Player1"</sqf>
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_filterString]]; --> |= Syntax
|x2= <sqf>["Player 1", "aelrPy"] call BIS_fnc_filterString; // returns "Player"</sqf>
 
|p1= |= Parameter 1
 
| |= Return value
____________________________________________________________________________________________
 
|x1= <code></code> |=
____________________________________________________________________________________________
 
| |= See also


|seealso= [[find]] [[BIS_fnc_inString]] [[splitString]] [[joinString]]
}}
}}
<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:filterString}}]]
[[Category:Functions|{{uc:filterString}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:filterString}}]]

Latest revision as of 17:22, 13 July 2022

Hover & click on the images for description

Description

Description:
Removes characters from a string based on the list of allowed characters.
Execution:
call
Groups:
Strings

Syntax

Syntax:
[text, allowedChars] call BIS_fnc_filterString
Parameters:
text:: String - text to filter
allowedChars: String - (Optional, default a..z, A..Z, 0..9, "_") allowed characters
Return Value:
String - filtered text with only the allowed characters supplied in the filter.

Examples

Example 1:
["Player 1 @%!@$"] call BIS_fnc_filterString; // returns "Player1"
Example 2:
["Player 1", "aelrPy"] call BIS_fnc_filterString; // returns "Player"

Additional Information

See also:
find BIS_fnc_inString splitString joinString

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