comparison Core/Toolbox.cpp @ 247:c9b3ba0fd140

path management in zip files
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 04 Dec 2012 17:27:23 +0100
parents 7f74209ea0f8
children 3c291753231f
comparison
equal deleted inserted replaced
246:fe6ba20d00a8 247:c9b3ba0fd140
564 { 564 {
565 boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); 565 boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
566 return boost::posix_time::to_iso_string(now); 566 return boost::posix_time::to_iso_string(now);
567 } 567 }
568 568
569 569 std::string Toolbox::StripSpaces(const std::string& source)
570 {
571 size_t first = 0;
572
573 while (first < source.length() &&
574 isspace(source[first]))
575 {
576 first++;
577 }
578
579 if (first == source.length())
580 {
581 // String containing only spaces
582 return "";
583 }
584
585 size_t last = source.length();
586 while (last > first &&
587 isspace(source[last - 1]))
588 {
589 last--;
590 }
591
592 assert(first <= last);
593 return source.substr(first, last - first);
594 }
570 } 595 }