mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core: String::GetCharCount
git-svn-id: svn://ultimatepp.org/upp/trunk@3835 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
d6bd9c9bd0
commit
4f654ccc2b
3 changed files with 13 additions and 0 deletions
|
|
@ -307,6 +307,11 @@ WString String::ToWString() const
|
|||
return WString(Begin(), GetCount());
|
||||
}
|
||||
|
||||
int String::GetCharCount() const
|
||||
{
|
||||
return GetDefaultCharset() == CHARSET_UTF8 ? utf8len(Begin(), GetCount()) : GetCount();
|
||||
}
|
||||
|
||||
String::String(StringBuffer& b)
|
||||
{
|
||||
if(b.begin == b.buffer) {
|
||||
|
|
|
|||
|
|
@ -313,6 +313,7 @@ public:
|
|||
String& operator<<=(const String& s) { if(this != &s) { String0::Free(); String0::Set(s, s.GetCount()); } return *this; }
|
||||
|
||||
void Shrink() { *this = String(Begin(), GetLength()); }
|
||||
int GetCharCount() const;
|
||||
|
||||
String() {}
|
||||
String(const Nuller&) {}
|
||||
|
|
|
|||
|
|
@ -100,6 +100,13 @@ empty [* String]).&]
|
|||
[s2; Reduces memory used by string to minimum (size optimization).&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:String`:`:GetCharCount`(`)const:%- [@(0.0.255) int]_[* GetCharCount]()_[@(0.0.255) con
|
||||
st]&]
|
||||
[s2; Returns a number of characters contained in String. This is
|
||||
equal GetCount() if default charset is not UTF`-8, but different
|
||||
for UTF`-8. It is faster equivalent of ToWString().GetCount().&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:String`:`:ToWString`(`)const:%- [_^WString^ WString]_[* ToWString]()_[@(0.0.255) const
|
||||
]&]
|
||||
[s2; Convert String to WString using current default character set.&]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue