BIS fnc inString: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (1 revision)
m (example added)
Line 29: Line 29:
____________________________________________________________________________________________
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_inString]]; --> |= Syntax
| [searchTerm, searchText(, caseSensitive)] call BIS_fnc_inString; |= Syntax


|p1= |= Parameter 1
|p1= searchTerm: [[String]] - string to find|= Parameter 1
|p2= searchText: [[String]] - string to search in|= Parameter 2
|p3= caseSensitive (optional): [[Boolean]] - defines whether the search is case-sensitive (true) or not (false, by default)|= Parameter 3


| |= Return value
| [[Boolean]] - true if search term is found, false if not |= Return value
____________________________________________________________________________________________
____________________________________________________________________________________________


|x1= <code></code> |=  
|x1= <code>["rabbit", "I ate a rabbit today"] call BIS_fnc_inString // will return true</code> |=
|x2= <code>["RaBbiT", "I ate a rabbit today"] call BIS_fnc_inString // will return true</code> |=
|x3= <code>["RaBbiT", "I ate a rabbit today", true] call BIS_fnc_inString // will return false because of case sensitivity</code> |=  
____________________________________________________________________________________________
____________________________________________________________________________________________


| |= See also
| [[find]] |= See also


}}
}}

Revision as of 18:19, 24 July 2016


Hover & click on the images for description

Description

Description:
/*
	File: inString.sqf
	
	Description:
	Find a string within a string.
	
	Parameter(s):
	_this select 0: <string> string to be found
	_this select 1: <string> string to search from
	_this select 2 (Optional): <boolean> search is case sensitive (default: false)
	
	Returns:
	Boolean (true when string is found).
	
	How to use:
	_found = ["string", "String", true] call BIS_fnc_inString;
*/

(Placeholder description extracted from the function header by BIS_fnc_exportFunctionsToWiki)
Execution:
call
Groups:
Uncategorised

Syntax

Syntax:
[searchTerm, searchText(, caseSensitive)] call BIS_fnc_inString;
Parameters:
searchTerm: String - string to find
searchText: String - string to search in
caseSensitive (optional): Boolean - defines whether the search is case-sensitive (true) or not (false, by default)
Return Value:
Boolean - true if search term is found, false if not

Examples

Example 1:
["rabbit", "I ate a rabbit today"] call BIS_fnc_inString // will return true
Example 2:
["RaBbiT", "I ate a rabbit today"] call BIS_fnc_inString // will return true
Example 3:
["RaBbiT", "I ate a rabbit today", true] call BIS_fnc_inString // will return false because of case sensitivity

Additional Information

See also:
find

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

Bottom Section