ListIndexExists

Checks if a list has a given index

Method Signature

ListIndexExists(list=[string], index=[integer], delimiter=[string], includeEmptyFields=[boolean])

Arguments

Argument
Type
Required
Description
Default

list

string

true

string list to check for an index

index

integer

true

numeric The index to check for

delimiter

string

false

string the list delimiter

,

includeEmptyFields

boolean

false

boolean whether to include empty fields in the returned result

false

Examples

Simple listIndexExists

Check whether the index is exists or not in list

<bx:set list = "Apple,Orange,Banana,Graphs" >
<bx:if listIndexExists( list, 2 ) >
	<bx:set list = listsetAt( list, 2, "Goa" ) >
</bx:if>
<bx:output>#list#</bx:output>

Result: Apple,Goa,Banana,Graphs

Additional Examples

Run Example

// Simple Example
writeoutput( listIndexExists( "Susi,LAS,,boxlang,,,test", 3 ) );
// Member Function
strList = ",I,,love,boxlang,,";
writeDump( strList.listIndexExists( 6 ) );
 // Not exists, returns false

Last updated

Was this helpful?