find: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
m (Not sure about this change. Technically, it was introduced in Arma I, and then backported to OFP 1.99. Feel free to rollback.) |
||
Line 2: | Line 2: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| | | ofp |= Game name | ||
|1. | |1.99|= Game version | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
Revision as of 08:45, 25 September 2014
Description
- Description:
- Searches for an array element within array or a string within a string (since ["Arma 3","Arma3",127,126674,"Development"]). Returns the 0 based index on success or -1 if not found. Test is cASe-seNsItiVE
- Groups:
- Uncategorised
Syntax
- Syntax:
- array find x
- Parameters:
- array: Array - array to search in
- x: Anything - array element to find
- Return Value:
- Number - 0 based position of the first array element that matches x, -1 if not found
Alternative Syntax
- Syntax:
- string find x
- Parameters:
- string: String - string to search in
- x: String - string to find
- Return Value:
- Number 0 based position of the first sequence of characters that matches x, -1 if not found
Examples
- Example 1:
["Apples","Oranges","Pears"] find "Oranges"; //result is 1 [1,[2],[[3]]] find [[3]]; //result is 2
- Example 2:
if (magazines player find "Strela" >= 0) then {hint "You've got Strela!"};
- Example 3:
hint str ("japa is the man!" find "the man!"); //8
Additional Information
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
Categories:
- Scripting Commands
- Introduced with Operation Flashpoint version 1.99
- Operation Flashpoint: New Scripting Commands
- Operation Flashpoint: Scripting Commands
- Command Group: Uncategorised
- Scripting Commands OFP 1.99
- Scripting Commands ArmA
- Command Group: Variables
- Scripting Commands ArmA2
- Scripting Commands Arma 3
- Scripting Commands Take On Helicopters