string
- comment
A length delimited byte addressable string type.
JASS strings are written inside double-quote
""(example:"example"). There are 2 null values for strings:""andnull.Localized Strings
Some game API functions (natives) support the usage of
TRIGSTR_prefix at the start of the string. Such strings are read from the "war3map.wts" file to allow their localization. For example: "TRIGSTR_001" will be replaced by the game with the string number 1 defined in the .wts file.Control Characters
Both
\nand\rare treated as new-line characters (v1.32.10).\"Allows to include double-quotes inside strings, example:"Then he said \"Hello!\" and that was it."\\Allows to use the backslash\character, because a single\is used to escape the next character. When you use\\the game considers it a single\, if you only place a single\it may cause a compiler crash.- Correct:
"Here comes the backslash: \\ end" - Correct:
"Here comes the new line: \n end" - Incorrect:
"The space character should not be escaped: \ end"
Formatting
-
|cAARRGGBBchange the color of the following text in the string.AAis alpha,RRis red,GGis green andBBis blue. The colors are specified as a hexadecimal values example:|cffcc1100. -
|rWill reset the color of the text back to default (white). -
|nEquivalent to new-line in some places, but might not work correctly in other places. For example,DisplayTimedTextToPlayerworks with\nbut not with|n(v1.32.10).
http://www.hiveworkshop.com/forums/lab-715/documentation-string-type-240473/
- Correct:
- note
Limitations
The maximum string length in JASS code is limited to ca. 4096 ASCII characters. WorldEditor and some game functions/places may have lower limits (esp. GUI triggers).
v1.32.10: Quest description is limited to 30000 ASCII in WorldEditor, but only the last 2456 characters are displayed in-game. A building's extended tooltip is limited to 8191 ASCII characters in-game and in WorldEditor.
- Source
- builtin-types.j (suggest an edit or discuss on Github)
- Source code
type string extends void