跳转到主内容

//ERDDAP/com.cohort.util/ScriptString2/indexOf

indexOf

[JVM]
open fun indexOf(iArray: Array<Int>, i: Int, fromIndex: Int): Int

Finds the first instance of i at or after fromIndex (0.. ) in iArray.

Return

The first instance of i. If not found, it returns -1.

Parameters

JVM

iArray
i
fromIndex

[JVM]
open fun indexOf(iArray: Array<Int>, i: Int): Int

Finds the first instance of i in iArray.

Return

The first instance of i. If not found, it returns -1.

Parameters

JVM

iArray
i

[JVM]
open fun indexOf(cArray: Array<Char>, c: Char, fromIndex: Int): Int

Finds the first instance of c at or after fromIndex (0.. ) in cArray.

Return

The first instance of c. If not found, it returns -1.

Parameters

JVM

cArray
c
fromIndex

[JVM]
open fun indexOf(cArray: Array<Char>, c: Char): Int

Finds the first instance of c in cArray.

Return

The first instance of c. If not found, it returns -1.

Parameters

JVM

cArray
c

[JVM]
open fun indexOf(s: String, car: String, fromIndex: Int): Int

This indexOf is a little different: it finds the first instance in s of any char in car.

Return

The first instance in s of any char in car. If not found, it returns -1.

Parameters

JVM

sa string
carthe chars you want to find any of
fromIndexthe index number of the position to start the search

[JVM]
open fun indexOf(dArray: Array<Double>, d: Double, fromIndex: Int): Int

Finds the first instance of d at or after fromIndex (0.. ) in dArray (tested with Math2.almostEqual5).

Return

The first instance of d. If not found, it returns -1.

Parameters

JVM

dArray
d
fromIndex

[JVM]
open fun indexOf(dArray: Array<Double>, d: Double): Int

Finds the first instance of d in dArray (tested with Math2.almostEqual5).

Return

The first instance of d. If not found, it returns -1.

Parameters

JVM

dArray
d

[JVM]
open fun indexOf(ar: Array<Any>, s: String): Int

This finds the first element in Object[] where the ar[i].toString value equals to s.

Return

the element number of ar which is equal to s (or -1 if ar is null, or s is null or not found)

Parameters

JVM

arthe array of Objects (Strings?)
sthe String to be found

[JVM]
open fun indexOf(ar: Array<Any>, s: String, startAt: Int): Int

This finds the first element in Object[] (starting at element startAt) where the ar[i].toString value equals s.

Return

the element number of ar which is equal to s (or -1 if ar is null, or s is null or not found)

Parameters

JVM

arthe array of Objects
sthe String to be found
startAtthe first element of ar to be checked. If startAt <0, this starts with startAt = 0. If startAt >= ar.length, this returns -1.