/**
 * This function finds the index of a specific character in a string and returns it.
 *
 * @param string The string to search through.
 * @param char The character to find the index of.
 * @return The index of the specified character within the string.
 * @throws IllegalArgumentException If the character is not present in the string.
 *
 * Example:
 * indexString("Hello World", 'o') // 4
 * indexString("Hello World", 'x') // IllegalArgumentException: Character not found in string.
 */
fun indexString(string: String, char: Char): Int {

    var index = 0

    for (c in string) {
        if (c == char) {
            return index
        }
        index++
    }

    throw IllegalArgumentException("Character not found in string.")
}
/**
 * This function finds the index of a specific character in a string and returns it.
 *
 * @param string The string to search through.
 * @param char The character to find the index of.
 * @return The index of the specified character within the string.
 * @throws IllegalArgumentException If the character is not present in the string.
 *
 * Example:
 * indexString("Hello World", 'o') // 4
 * indexString("Hello World", 'x') // IllegalArgumentException: Character not found in string.
 */
fun indexString(string: String, char: Char): Int {
/**
 * This function finds the index of a specific character in a string and returns it.
 *
 * @param string The string to search through.
 * @param char The character to find the index of.
 * @return The index of the specified character within the string.
 * @throws IllegalArgumentException If the character is not present in the string.
 *
 * Example:
 * indexString("Hello World", 'o') // 4
 * indexString("Hello World", 'x') // IllegalArgumentException: Character not found in string.
 */
fun indexString(string: String, char: Char): Int {

    var index = 0

    for (c in string) {
        if (c == char) {
            return index
        }
        index++
    }

    throw IllegalArgumentException("Character not found in string.")
}