Switched to some boost string functions inside locate(int, std::string).