MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / StringFindFirstOf

Function StringFindFirstOf

Sources/Jazz2/Scripting/RegisterString.cpp:364–368  ·  view source on GitHub ↗

This function returns the index of the first position where the one of the bytes in substring exists in the input string. If the characters in the substring doesn't exist in the input string -1 is returned. int string::findFirstOf(const string &in sub, uint start = 0) const

Source from the content-addressed store, hash-verified

362 //
363 // int string::findFirstOf(const string &in sub, uint start = 0) const
364 static std::int32_t StringFindFirstOf(const String& sub, std::uint32_t start, const String& str)
365 {
366 auto found = str.exceptPrefix(start).findAny(sub);
367 return (found != nullptr ? (std::int32_t)(found.begin() - str.begin()) : -1);
368 }
369
370 // This function returns the index of the last position where the one of the bytes in substring
371 // exists in the input string. If the characters in the substring doesn't exist in the input

Callers

nothing calls this directly

Calls 3

findAnyMethod · 0.45
exceptPrefixMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected