Fix (i)strip_CR
This commit is contained in:
parent
e88023a17f
commit
c5633cc2ea
1 changed files with 3 additions and 4 deletions
|
@ -9,16 +9,15 @@ std::string strip_CR(const std::string& str)
|
||||||
|
|
||||||
void istrip_CR(std::string& str)
|
void istrip_CR(std::string& str)
|
||||||
{
|
{
|
||||||
std::string x = str;
|
|
||||||
size_t crc = 0;
|
size_t crc = 0;
|
||||||
size_t xl = x.length();
|
size_t xl = str.length();
|
||||||
while(crc < xl) {
|
while(crc < xl) {
|
||||||
char y = x[xl - crc - 1];
|
char y = str[xl - crc - 1];
|
||||||
if(y != '\r' && y != '\n')
|
if(y != '\r' && y != '\n')
|
||||||
break;
|
break;
|
||||||
crc++;
|
crc++;
|
||||||
}
|
}
|
||||||
x.substr(0, xl - crc);
|
str = str.substr(0, xl - crc);
|
||||||
}
|
}
|
||||||
|
|
||||||
int firstchar(const std::string& str)
|
int firstchar(const std::string& str)
|
||||||
|
|
Loading…
Add table
Reference in a new issue