Subversion Repositories spk

Rev

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

Rev 43 Rev 48
Line 385... Line 385...
385
		newstr.replace(pos, find.length(), replace);
385
		newstr.replace(pos, find.length(), replace);
386
		pos = newstr.find(find, pos + replace.length());
386
		pos = newstr.find(find, pos + replace.length());
387
	}
387
	}
388
 
388
 
389
	return newstr;
389
	return newstr;
-
 
390
}
-
 
391
 
-
 
392
String String::findRemove(const String &find) const
-
 
393
{
-
 
394
	Utils::String replace = *this;
-
 
395
 
-
 
396
	std::string::size_type pos = replace.find(find, 0 );
-
 
397
	while ( pos != std::string::npos ) {
-
 
398
		replace.erase ( pos, find.length() );
-
 
399
		pos = replace.find(find, pos);
-
 
400
	}
-
 
401
 
-
 
402
	return replace;
-
 
403
}
-
 
404
 
-
 
405
String String::stripHtml() const
-
 
406
{
-
 
407
	// if empty, theres no to strip
-
 
408
	if ( this->empty() ) return "";
-
 
409
 
-
 
410
	// replace break line with a new line
-
 
411
	Utils::String newStr = (*this);
-
 
412
	newStr = newStr.findReplace("<br/>", "\n");
-
 
413
	newStr = newStr.findReplace("<br />", "\n");
-
 
414
	newStr = newStr.findReplace("<p>", "\n\t");
-
 
415
	newStr = newStr.findReplace("</p>", "\n");
-
 
416
 
-
 
417
	// find any remaining tags and remove them
-
 
418
	std::string::size_type pos     = newStr.find_first_of('<', 0);
-
 
419
	std::string::size_type lastPos = newStr.find_first_of('>', pos);
-
 
420
 
-
 
421
	while (std::string::npos != pos || std::string::npos != lastPos)
-
 
422
	{
-
 
423
		if ( lastPos > newStr.length() ) break;
-
 
424
		// remove the tag
-
 
425
		newStr.erase(pos, lastPos + 1);
-
 
426
 
-
 
427
		// find the next tag
-
 
428
		pos = newStr.find_first_of('<', pos);
-
 
429
		lastPos = newStr.find_first_of('>', pos);
-
 
430
	}
-
 
431
 
-
 
432
	// now remove all the starting new lines
-
 
433
	while ( newStr[0] == '\n' || newStr[0] == '\t' ) newStr.erase(0, 1);
-
 
434
	return newStr;
390
}
435
}
391
 
436
 
392
bool String::isin(const String &str, bool bCaseSensative) const
437
bool String::isin(const String &str, bool bCaseSensative) const
393
{
438
{
394
	unsigned int check = 0;
439
	unsigned int check = 0;