ListFind
Return int position of value in delimited list, case sensitive or case-insenstive variations
Method Signature
ListFind(list=[string], value=[string], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean])
Arguments
Argument
Type
Required
Description
Default
list
string
true
The list to be searched.
value
string
true
The value to locate in the list or a function to filter the list
delimiter
string
false
The list delimiter(s)
,
includeEmptyFields
boolean
false
Whether to include empty fields in the search
false
multiCharacterDelimiter
boolean
false
false
Examples
Basic Example
Find item in a list and return the index.
listFindNoCase( "apple,orange,banana", "orange" );
Result: 2
Different Delimiters
Find item in a pipe delimited list and return the index.
listFindNoCase( "apple|orange|banana", "orange", "|" );
Result: 2
Member Syntax
listFindNoCase as a member function
fruits = "apple|orange|banana";
writeOutput( fruits.listFindNoCase( "ORANGE", "|" ) );
Result: 2
Additional Examples
writeOutput( listFindNoCase( "I,love,boxlang,testFile", "BOXLANG" ) ); // Expected output 3
// Member Function with @ delimiter
strList = "I@am@boxlang@dev";
writeDump( strList.listFindNoCase( "Dev", "@" ) );
// Expected output 4
Related
Last updated
Was this helpful?