Subversion Repositories spk

Rev

Rev 56 | Rev 69 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 56 Rev 58
Line 418... Line 418...
418
		replace.erase ( pos, find.length() );
418
		replace.erase ( pos, find.length() );
419
		pos = replace.find(find, pos);
419
		pos = replace.find(find, pos);
420
	}
420
	}
421

421

422
	return replace;
422
	return replace;
-
 
423
}
-
 
424

-
 
425
String String::removeIf(int iChar, char c) const
-
 
426
{
-
 
427
	Utils::String newStr = *this;
-
 
428
	if ( this->at(iChar) == c ) newStr.erase(iChar, 1);
-
 
429
	return newStr;
423
}
430
}
424

431

425
String String::stripHtml() const
432
String String::stripHtml() const
426
{
433
{
427
	// if empty, theres no to strip
434
	// if empty, theres no to strip
428
	if ( this->empty() ) return "";
435
	if ( this->empty() ) return "";
429
436
430
	// replace break line with a new line
437
	// replace break line with a new line
431
	Utils::String newStr = (*this);
438
	Utils::String newStr = (*this);
432
	newStr = newStr.findReplace("<br/>", "\n");
439
	newStr = newStr.findReplace("<br/>", "\n");
433
	newStr = newStr.findReplace("<br />", "\n");
440
	newStr = newStr.findReplace("<br />", "\n");
434
	newStr = newStr.findReplace("<p>", "\n\t");
441
	newStr = newStr.findReplace("<p>", "\n\t");
Line 454... Line 461...
454
	return newStr;
461
	return newStr;
455
}
462
}
456

463

457
bool String::isin(const String &str, bool bCaseSensative) const
464
bool String::isin(const String &str, bool bCaseSensative) const
458
{
465
{
459
	unsigned int check = 0;
-
 
460
	for ( unsigned int i = 0; i < this->length(); i++ )
-
 
461
	{
-
 
462
		bool bCheck	= (bCaseSensative) ? (this->at(i) == str[check]) : (tolower(this->at(i)) == tolower(str[check]));
466
	if ( bCaseSensative ) return (this->find(str, 0) == std::string::npos) ? false : true;
463
		if ( bCheck )
-
 
464
			++check;
-
 
465
		else
-
 
466
			check = 0;
-
 
467
467
	
468
		if ( check >= str.length() )
468
	String thisLower = this->lower();
469
			return true;
469
	String strLower = str.lower();
470
	}
-
 
471
	return false;
470
	return (thisLower.find(strLower, 0) == std::string::npos) ? false : true;
472
}
471
}
473

472

474
int String::findPos(const String &find, int iStartPos) const
473
int String::findPos(const String &find, int iStartPos) const
475
{
474
{
476
	std::string::size_type pos = this->find(find, iStartPos);
475
	std::string::size_type pos = this->find(find, iStartPos);