sdlWcsnstr function

Pointer<Int16> sdlWcsnstr(
  1. Pointer<Int16> haystack,
  2. Pointer<Int16> needle,
  3. int maxlen
)

Search a wide string, up to n wide chars, for the first instance of a specific substring.

The search ends once it finds the requested substring, or a null terminator value to end the string, or maxlen wide character have been examined. It is possible to use this function on a wide string without a null terminator.

Note that this looks for strings of wide characters, not codepoints, so it's legal to search for malformed and incomplete UTF-16 sequences.

\param haystack the wide string to search. Must not be NULL. \param needle the wide string to search for. Must not be NULL. \param maxlen the maximum number of wide characters to search in haystack. \returns a pointer to the first instance of needle in the string, or NULL if not 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 wchar_t * SDLCALL SDL_wcsnstr(const wchar_t *haystack, const wchar_t *needle, size_t maxlen)

Implementation

Pointer<Int16> sdlWcsnstr(
    Pointer<Int16> haystack, Pointer<Int16> needle, int maxlen) {
  final sdlWcsnstrLookupFunction = libSdl3.lookupFunction<
      Pointer<Int16> Function(
          Pointer<Int16> haystack, Pointer<Int16> needle, Uint32 maxlen),
      Pointer<Int16> Function(Pointer<Int16> haystack, Pointer<Int16> needle,
          int maxlen)>('SDL_wcsnstr');
  return sdlWcsnstrLookupFunction(haystack, needle, maxlen);
}