| 965 | */ |
| 966 | |
| 967 | std::size_t String::FindLast(char character, std::intmax_t start, UInt32 flags) const |
| 968 | { |
| 969 | if (character == '\0' || m_sharedString->size == 0) |
| 970 | return npos; |
| 971 | |
| 972 | if (start < 0) |
| 973 | start = std::max<std::size_t>(m_sharedString->size + start, 0); |
| 974 | |
| 975 | std::size_t pos = static_cast<std::size_t>(start); |
| 976 | if (pos >= m_sharedString->size) |
| 977 | return npos; |
| 978 | |
| 979 | char* ptr = &m_sharedString->string[m_sharedString->size-1]; |
| 980 | |
| 981 | if (flags & CaseInsensitive) |
| 982 | { |
| 983 | character = Detail::ToLower(character); |
| 984 | do |
| 985 | { |
| 986 | if (Detail::ToLower(*ptr) == character) |
| 987 | return ptr - m_sharedString->string.get(); |
| 988 | } |
| 989 | while (ptr-- != m_sharedString->string.get()); |
| 990 | } |
| 991 | else |
| 992 | { |
| 993 | do |
| 994 | { |
| 995 | if (*ptr == character) |
| 996 | return ptr - m_sharedString->string.get(); |
| 997 | } |
| 998 | while (ptr-- != m_sharedString->string.get()); |
| 999 | } |
| 1000 | |
| 1001 | return npos; |
| 1002 | } |
| 1003 | |
| 1004 | /*! |
| 1005 | * \brief Finds the last index of the "C string" in the string |
no test coverage detected