CONCEPT
strings
DESCRIPTION
Strings in lpc are true strings, not arrays of characters
as in C (and not pointers to strings).
Strings are mutable -- that is, the contents of a string can be
modified as needed.
Strings are automatically concatenated by the gamedriver at runtime,
so the + operator is no longer strictly necessary to combine two
strings. For example:
write("This is string one. "
"This is string two.");
will print out:
This is string one. This is string two.
LPC does not have a 'char' datatype. It is possible, though, to
count and access individual characters by using indexing (array
notation). For example,
string s;
s = "abcdefg";
return s[2]; // returns 'c'
Note that although 'c' (in single quotes) is returned, this is
not a char! The gamedriver treats such values as integers containing
the ascii value of the character.
The gamedriver performs run-time bounds checking on strings.
String indexes begin counting with 0, like arrays.
Most string output automatically wraps to line length in OSB.
SEE ALSO
types(LPC)