diff options
author | Alexis Menard <alexis.menard@nokia.com> | 2009-04-17 14:06:06 (GMT) |
---|---|---|
committer | Alexis Menard <alexis.menard@nokia.com> | 2009-04-17 14:06:06 (GMT) |
commit | f15b8a83e2e51955776a3f07cb85ebfc342dd8ef (patch) | |
tree | c5dc684986051654898db11ce73e03b9fec8db99 /doc/src/snippets/code/src_qt3support_tools_q3cstring.cpp | |
download | Qt-f15b8a83e2e51955776a3f07cb85ebfc342dd8ef.zip Qt-f15b8a83e2e51955776a3f07cb85ebfc342dd8ef.tar.gz Qt-f15b8a83e2e51955776a3f07cb85ebfc342dd8ef.tar.bz2 |
Initial import of statemachine branch from the old kinetic repository
Diffstat (limited to 'doc/src/snippets/code/src_qt3support_tools_q3cstring.cpp')
-rw-r--r-- | doc/src/snippets/code/src_qt3support_tools_q3cstring.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/doc/src/snippets/code/src_qt3support_tools_q3cstring.cpp b/doc/src/snippets/code/src_qt3support_tools_q3cstring.cpp new file mode 100644 index 0000000..9985e9d --- /dev/null +++ b/doc/src/snippets/code/src_qt3support_tools_q3cstring.cpp @@ -0,0 +1,40 @@ +//! [0] +Q3CString str("helloworld", 6); // assigns "hello" to str +//! [0] + + +//! [1] +Q3CString a; // a.data() == 0, a.size() == 0, a.length() == 0 +Q3CString b == ""; // b.data() == "", b.size() == 1, b.length() == 0 +a.isNull(); // true because a.data() == 0 +a.isEmpty(); // true because a.length() == 0 +b.isNull(); // false because b.data() == "" +b.isEmpty(); // true because b.length() == 0 +//! [1] + + +//! [2] +Q3CString s = "truncate this string"; +s.truncate(5); // s == "trunc" +//! [2] + + +//! [3] +Q3CString s; +s.sprintf("%d - %s", 1, "first"); // result < 256 chars + +Q3CString big(25000); // very long string +big.sprintf("%d - %s", 2, longString); // result < 25000 chars +//! [3] + + +//! [4] +Q3CString s("apple"); +Q3CString t = s.leftJustify(8, '.'); // t == "apple..." +//! [4] + + +//! [5] +Q3CString s("pie"); +Q3CString t = s.rightJustify(8, '.'); // t == ".....pie" +//! [5] |