01.03.2011 - as a initial commit
This commit is contained in:
21
pistring.cpp
21
pistring.cpp
@@ -22,6 +22,13 @@ PIString & PIString::operator +=(const PIString & str) {
|
||||
}
|
||||
|
||||
|
||||
PIString & PIString::operator +=(const PIByteArray & ba) {
|
||||
uint l = ba.size();
|
||||
for (uint i = 0; i < l; ++i) push_back(ba[i]);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
bool PIString::operator ==(const PIString & str) const {
|
||||
uint l = str.size();
|
||||
if (size() != l) return false;
|
||||
@@ -106,6 +113,20 @@ PIString & PIString::trim() {
|
||||
}
|
||||
|
||||
|
||||
PIStringList PIString::split(const PIString & delim) {
|
||||
PIString ts(*this);
|
||||
PIStringList sl;
|
||||
int ci = ts.find(delim);
|
||||
while (ci >= 0) {
|
||||
sl << ts.left(ci);
|
||||
ts.cutLeft(ci + delim.length());
|
||||
ci = ts.find(delim);
|
||||
}
|
||||
if (ts.length() > 0) sl << ts;
|
||||
return sl;
|
||||
}
|
||||
|
||||
|
||||
int PIString::find(const char str, const int start) {
|
||||
for (int i = start; i < length(); ++i)
|
||||
if (at(i) == str)
|
||||
|
||||
Reference in New Issue
Block a user