src/Generic/common/LocatedString.cpp
/**
 * Returns <code>-1</code> if the string is not found.
 *
 * @param str the string to search for.
 * @param start the first index to start searching at.
 * @return the first index of the given string in this LocatedString,
 *         or <code>-1</code> if the string is not found.
 */
1 if the string is not found.

@param str the string to search for.
@param start the first index to start searching at.
@return the first index of the given string in this LocatedString,
or -1 if the string is not found.
1 if the string is not found . @param str the string to search for . @param start the first index to start searching at . @return the first index of the given string in this LocatedString or - 1 if the string is not found .
int LocatedString::indexOf(const wchar_t *str, int start) const {
	if (start >= length()) {
		return (str[0] == L'\0') ? length() : -1;
	}
	if (start < 0) {
		start = 0;
	}
	if (str[0] == L'\0') {
		return start;
	}
	size_t pos = _text.find(str, start);
	return (pos == std::wstring::npos) ? -1 : static_cast<int>(pos);
}
int LocatedString :: indexOf ( const wchar_t * str , int start ) const { if ( start >= length ( ) ) { return ( str [ 0 ] == L' \0 ' ) ? length ( ) : -1 ; } if ( start < 0 ) { start = 0 ; } if ( str [ 0 ] == L' \0 ' ) { return start ; } size_t pos = _text . find ( str , start ) ; return ( pos == std :: wstring :: npos ) ? -1 : static_cast < int > ( pos ) ; }
Returns <code>-1</code> if the string is not found.
Returns <code > - 1< / code > if the string is not found .
// If we're searching beyond the end of the string, then an
 // empty string is found exactly at the end, and any other
 // string is not found at all.
 // We can't start before the string.
 // An empty string is always found immediately.
