[gnote/stable-0.6] Make sharp::string_to_lowercase, sharp::string_substring Unicode aware
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote/stable-0.6] Make sharp::string_to_lowercase, sharp::string_substring Unicode aware
- Date: Mon, 22 Mar 2010 15:50:17 +0000 (UTC)
commit 6bda2a290aac1735ef8db80b51dc842ed6a5fe73
Author: Debarshi Ray <debarshir src gnome org>
Date: Mon Mar 15 03:13:30 2010 +0200
Make sharp::string_to_lowercase, sharp::string_substring Unicode aware
Fixes: https://bugzilla.gnome.org/610406
src/sharp/string.cpp | 12 ++++++------
src/sharp/string.hpp | 6 +++---
2 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/src/sharp/string.cpp b/src/sharp/string.cpp
index ab845b2..7045f7c 100644
--- a/src/sharp/string.cpp
+++ b/src/sharp/string.cpp
@@ -82,18 +82,18 @@ namespace sharp {
boost::split(split, source, boost::is_any_of(delimiters));
}
- std::string string_substring(const std::string & source, int start)
+ Glib::ustring string_substring(const Glib::ustring & source, int start)
{
DBG_ASSERT(start >= 0, "start can't be negative");
if(source.size() <= (unsigned int)start) {
return "";
}
- return std::string(source.begin() + start, source.end());
+ return Glib::ustring(source, start, std::string::npos);
}
- std::string string_substring(const std::string & source, int start, int len)
+ Glib::ustring string_substring(const Glib::ustring & source, int start, int len)
{
- return std::string(source.begin() + start, source.begin() + start + len);
+ return Glib::ustring(source, start, len);
}
std::string string_trim(const std::string & source)
@@ -178,9 +178,9 @@ namespace sharp {
}
- std::string string_to_lower(const std::string & source)
+ Glib::ustring string_to_lower(const Glib::ustring & source)
{
- return boost::to_lower_copy(source);
+ return source.lowercase();
}
}
diff --git a/src/sharp/string.hpp b/src/sharp/string.hpp
index a42c6cb..fd63564 100644
--- a/src/sharp/string.hpp
+++ b/src/sharp/string.hpp
@@ -60,9 +60,9 @@ namespace sharp {
const char * delimiters);
/** copy the substring for %source, starting at %start until the end */
- std::string string_substring(const std::string & source, int start);
+ Glib::ustring string_substring(const Glib::ustring & source, int start);
/** copy the substring for %source, starting at %start and running for %len */
- std::string string_substring(const std::string & source, int start, int len);
+ Glib::ustring string_substring(const Glib::ustring & source, int start, int len);
std::string string_trim(const std::string & source);
std::string string_trim(const std::string & source, const char * set_of_char);
@@ -74,7 +74,7 @@ namespace sharp {
int string_index_of(const std::string & source, const std::string & with, int);
int string_last_index_of(const std::string & source, const std::string & with);
- std::string string_to_lower(const std::string & source);
+ Glib::ustring string_to_lower(const Glib::ustring & source);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]