sdlStrpbrk function
Searches a string for the first occurence of any character contained in a breakset, and returns a pointer from the string to that character.
\param str The null-terminated string to be searched. Must not be NULL, and
must not overlap with breakset
.
\param breakset A null-terminated string containing the list of characters
to look for. Must not be NULL, and must not overlap with
str
.
\returns A pointer to the location, in str, of the first occurence of a
character present in the breakset, or NULL if none is found.
\threadsafety It is safe to call this function from any thread.
\since This function is available since SDL 3.1.3.
extern SDL_DECLSPEC char * SDLCALL SDL_strpbrk(const char *str, const char *breakset)
Implementation
Pointer<Int8> sdlStrpbrk(String? str, String? breakset) {
final sdlStrpbrkLookupFunction = libSdl3.lookupFunction<
Pointer<Int8> Function(Pointer<Utf8> str, Pointer<Utf8> breakset),
Pointer<Int8> Function(
Pointer<Utf8> str, Pointer<Utf8> breakset)>('SDL_strpbrk');
final strPointer = str != null ? str.toNativeUtf8() : nullptr;
final breaksetPointer = breakset != null ? breakset.toNativeUtf8() : nullptr;
final result = sdlStrpbrkLookupFunction(strPointer, breaksetPointer);
calloc.free(strPointer);
calloc.free(breaksetPointer);
return result;
}