mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 11:31:53 +01:00
double-conversion floating-point conversions
- using double-conversion library for floating-point numeric/string conversions - added string replace[InPlace], remove[InPlace] - reverted overwritten FileChannel purge age and count features - file size value checks in SMTPClient
This commit is contained in:
@@ -165,6 +165,22 @@ std::string replace(const std::string& str, const std::string::value_type* from,
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
std::string replace(const std::string& str, const std::string::value_type from, const std::string::value_type to, std::string::size_type start)
|
||||
{
|
||||
std::string result(str);
|
||||
replaceInPlace(result, from, to, start);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
std::string remove(const std::string& str, const std::string::value_type ch, std::string::size_type start)
|
||||
{
|
||||
std::string result(str);
|
||||
replaceInPlace(result, ch, 0, start);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
std::string& replaceInPlace(std::string& str, const std::string& from, const std::string& to, std::string::size_type start)
|
||||
{
|
||||
@@ -215,6 +231,31 @@ std::string& replaceInPlace(std::string& str, const std::string::value_type* fro
|
||||
}
|
||||
|
||||
|
||||
std::string& replaceInPlace(std::string& str, const std::string::value_type from, const std::string::value_type to, std::string::size_type start)
|
||||
{
|
||||
if (from == to) return str;
|
||||
|
||||
std::string::size_type pos = 0;
|
||||
do
|
||||
{
|
||||
pos = str.find(from, start);
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
if (to) str[pos] = to;
|
||||
else str.erase(pos, 1);
|
||||
}
|
||||
} while (pos != std::string::npos);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
std::string& removeInPlace(std::string& str, const std::string::value_type ch, std::string::size_type start)
|
||||
{
|
||||
return replaceInPlace(str, ch, 0, start);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user