mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
.reference
git-svn-id: svn://ultimatepp.org/upp/trunk@9846 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
1be84557f3
commit
8b8703b192
3 changed files with 83 additions and 0 deletions
68
reference/Strings/Strings.cpp
Normal file
68
reference/Strings/Strings.cpp
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
String s = "Hello world";
|
||||
|
||||
DUMP(s);
|
||||
s.Cat('!');
|
||||
DUMP(s);
|
||||
|
||||
DUMP(*s.Last());
|
||||
DUMP(s[0]);
|
||||
DUMP(s.GetCount());
|
||||
|
||||
DUMP(s.Compare("Abel"));
|
||||
DUMP(s.Compare("Hello world!"));
|
||||
DUMP(s.Compare("Goal"));
|
||||
|
||||
DUMP(s.Find('l'));
|
||||
DUMP(s.ReverseFind('l'));
|
||||
|
||||
DUMP(s.Find("llo"));
|
||||
DUMP(s.Find("xxx"));
|
||||
DUMP(s.FindAfter("llo"));
|
||||
DUMP(s.FindAfter("xxx"));
|
||||
|
||||
DUMP(s.StartsWith("Hello"));
|
||||
DUMP(s.EndsWith("!"));
|
||||
|
||||
DUMP(s.FindFirstOf("xyzw"));
|
||||
|
||||
DUMP(s.Mid(2, 3));
|
||||
DUMP(s.Left(2));
|
||||
DUMP(s.Right(2));
|
||||
|
||||
s.Replace("world", "Frank");
|
||||
DUMP(s);
|
||||
|
||||
s.Trim(5);
|
||||
DUMP(s);
|
||||
s.TrimLast();
|
||||
DUMP(s);
|
||||
|
||||
s.Insert(0, "String ");
|
||||
DUMP(s);
|
||||
|
||||
s << Point(12, 123);
|
||||
DUMP(s);
|
||||
|
||||
DUMP(s.TrimEnd("[12, 123]"));
|
||||
DUMP(s);
|
||||
DUMP(s.TrimEnd("xxx"));
|
||||
DUMP(s);
|
||||
DUMP(s.TrimStart("String "));
|
||||
DUMP(s);
|
||||
|
||||
s.Set(0, 'Y');
|
||||
DUMP(s);
|
||||
|
||||
WString ws = s.ToWString();
|
||||
ws << "o";
|
||||
DUMP(ws);
|
||||
|
||||
s = ws.ToString();
|
||||
DUMP(s);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue