Closed sifmelcara closed 8 years ago
IMHO std::string::find
will be better.
const string telnetPrefix = "telnet://";
if (url.find(telnetPrefix) == 0)
url.erase(0, telnetPrefix.size());
@legnaleurc Nice shot! @sifmelcara how about you?
I think substr() has better readability and speed(in worst case) in this case. However, I do not care things other than correctness much.
When will this patch release? cc @kidwm
I forgot to ask @fourdollars about this yesterday
url.find_first_not_of("telnet://") is wrong. Any prefix that contain characters in {'t', 'e', 'l', 'n', ':', '/'} will be removed. For example, "eod.tw" will be trimmed to "od.tw"