FindCharInString Function

Finds the first occurrence of a character in a string.

int FindCharInString(const char[] str, char c, bool reverse)


const char[] str


char c

Character to search for.

bool reverse

False (default) to search forward, true to search backward.

Return Value

The index of the first occurrence of the character in the string, or -1 if the character was not found.