Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/structures/src/String/Str.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,10 @@ sac_int SACstrspn(string str, string accept)

sac_int SACstrstr(string haystack, string needle)
{
return (sac_int)strstr(haystack, needle);
char * found = strstr(haystack, needle);
if (found == NULL) return -1;
sac_int index = found - haystack;
return index;
}

void SACstrtok(string* out_token, string* out_rest, string str, string delimiters)
Expand Down
Loading