Changes between Initial Version and Version 1 of doc/lol/base/string.h


Ignore:
Timestamp:
Feb 6, 2013, 12:58:22 AM (8 years ago)
Author:
sam
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • doc/lol/base/string.h

    v1 v1  
     1[[TOC]]
     2= <lol/base/string.h> =
     3
     4View this file in the source browser: [browser:trunk/src/lol/base/string.h]
     5
     6== String ==
     7
     8The `String` class encapsulates an array of chars representing '''UTF-8 characters'''.
     9
     10Strings can be constructed from other strings or from C-style strings:
     11
     12{{{
     13#!cpp
     14String s1;           /* Will be empty */
     15String s2("ABC");    /* Will contain "ABC" */
     16String s3("ABC", 2); /* Will contain "AB" */
     17String s4(s3);       /* Will contain "AB" */
     18}}}
     19
     20The length specifier helps building strings containing the null char:
     21
     22{{{
     23#!cpp
     24String s1("abc\0def");    /* Will contain "abc" */
     25String s2("abc\0def", 7); /* Will contain "abc\0def" */
     26}}}
     27
     28The contents of a string can be accessed as a constant C string using the `C()` accessor:
     29
     30{{{
     31#!cpp
     32String s("Hello!");
     33printf("%s\n", s.C());
     34}}}