int64_t find() - JanKulbaga/String-CPP GitHub Wiki

int64_t find()

The find() method returns the index of first occurrence of the substring (if found). If not found, it returns -1.

Example

#include "src/String.h"

int main()
{
    String s = "Hello World";
    s.find("l"); // gives value 2
    s.find("a"); // gives value -1
    return 0;
}

Parameters

const char* const str

Return value

Returns the index of the first occurence of the substring or -1.