If the the suffix string to test has one character more then the string to check, the function claims that XrdOucString ensdwith (s), e.g.
XrdOucString ew = "abcd";
ew.endswith("abcde" => true
because STR_NPOS=1
//______________________________________________________________________________
bool XrdOucString::endswith(const char *s)
{
// returns 1 if the stored string ends with string s
return (s ? (rfind(s) == (int)(len-strlen(s))) : 0);
}
The character function has probably the same issue when the XrdOucString is empty:
//______________________________________________________________________________
bool XrdOucString::endswith(char c)
{
// returns 1 if the stored string ends with string s
return (rfind(c) == (int)(len-1));
}
—
Reply to this email directly or view it on GitHub.
Use REPLY-ALL to reply to list
To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1