$indexOf
Returns the character index of a 'query' within 'text'.
Usage
$indexOf[text;query]
This function has two params.
Param
Description
Type
Required
text
The text that gets searched for 'query'.
String
Yes
query
The phrase/character to find within 'text'.
String
Yes
Remember the case of characters in `$indexOf[]` matters (e.g. searching for a lowercase `h` within `Hello` won't work). You can use [`$toLowerCase[]`](./tolowercase.md) to negate this issue.
Examples
Example #1
bot.commands.add({
type: "basicCommand",
name: "example",
code: `$indexOf[hi hello hey;hey]` //Returns 10
})
Example #2
bot.commands.add({
type: "basicCommand",
name: "example",
code: `$indexOf[DBD.TS is cool.;is]` //Returns 8
})
Example #3
bot.commands.add({
type: "basicCommand",
name: "example",
code: `$indexOf[DBD.TS is cool.;DBD.TS]` //Returns 1
})
Example #4
bot.commands.add({
type: "basicCommand",
name: "example",
code: `$indexOf[This is a example text!;t]` //Returns 19
})
Last updated
Was this helpful?