PIString::fromAscii() new overload

This commit is contained in:
2020-10-07 23:29:18 +03:00
parent cebe6f452f
commit 0004d2696f
3 changed files with 11 additions and 5 deletions

View File

@@ -333,11 +333,14 @@ PIString PIString::fromAscii(const char * s) {
ret.push_back(PIChar(s[l]));
++l;
}
/*while (s[l] != '\0') ++l;
return ret;
}
PIString PIString::fromAscii(const char * s, int len) {
PIString ret;
ret.resize(l);
for (int i = 0; i < l; ++i)
ret[i] = s[i];*/
for (int l = 0; l < len; ++l)
ret.push_back(PIChar(s[l]));
return ret;
}

View File

@@ -722,6 +722,9 @@ public:
//! \brief Return string constructed from ASCII
static PIString fromAscii(const char * s);
//! \brief Return string constructed from "len" chars ASCII
static PIString fromAscii(const char * s, int len);
//! \brief Return string constructed from "c" codepage
static PIString fromCodepage(const char * s, const char * c);