The string::RFind method does not work properly when using String::INVALID_INDEX as the start index. This is the default value for RFind and is intended to start looking at the end of the string.
Instead it just returns String::INVALID_INDEX. This is because the method does not actually handle the String::INVALID_INDEX value correctly like std::string::rfind does:
https://github.com/Solokiller/HL_Tools/blob/a028f420f535c086eb22a9c0ee5d026f57dd4b8f/src/stdlib/utility/CString.cpp#L796-L825
string::FindLastOf does work correctly, but is not a replacement for RFind.
Here's an example where it returns the wrong value:
string hostname = "Sven Co-op listen server | diff: 95%";
uint index = hostname.RFind("|");
index should be 25 but is actually String::INVALID_INDEX.
The
string::RFindmethod does not work properly when usingString::INVALID_INDEXas the start index. This is the default value for RFind and is intended to start looking at the end of the string.Instead it just returns
String::INVALID_INDEX. This is because the method does not actually handle theString::INVALID_INDEXvalue correctly likestd::string::rfinddoes:https://github.com/Solokiller/HL_Tools/blob/a028f420f535c086eb22a9c0ee5d026f57dd4b8f/src/stdlib/utility/CString.cpp#L796-L825
string::FindLastOfdoes work correctly, but is not a replacement forRFind.Here's an example where it returns the wrong value:
indexshould be25but is actuallyString::INVALID_INDEX.