aboutsummaryrefslogtreecommitdiff
path: root/src/base/string/find.c
blob: 20f990ebf08a552a6db03058194380710abe1a6f (plain)
1
2
3
4
5
6
7
8
9
10
11
#include "internal.h"

// find will find the first occurence of
// substr in the string returns -1 if nothing was found.
int
strยทfind(string s, const byte* substr)
{
    byte* loc = strstr(s, substr);
    if (loc == nil) return -1;
    return (int)(loc - s);
}