String
Syntax¶
Strings can use either single or double quotes and compile directly to DiamondFire String items.
The closing quote of a string must be on the same line of code as its opening quote.
Escape Sequences¶
Quotes, ampersands, and backslashes themselves can all be escaped by immediately preceeding them with a backslash.
player.sendMessage('jeff\'s',"\"amazing\"","creation"); // jeff's "amazing" creation
player.sendMessage(" / iron & diamonds \\ "); // / iron & diamonds \
Newlines can be inserted using \n.
Unicode Characters¶
Unicode characters be inserted using the \u escape code. This is especially useful when working with custom UI elements.
Warning
All escape sequences are evaluated at compile time. Due to this, the following is invalid:
Four digit unicode characters can be inserted using \uFFFF, where each F is a hexadecimal digit.
Unicode characters with more or less than 4 digits can be inserted using \u{}, with any number of hexadecimal digits inside the braces.
One-byte characters can be inserted using \xFF, where each F is a hexadecimal digit.
Legacy Formatting Codes¶
Legacy formatting codes can be inserted by directly using the section symbol (§). Ampersands (&) will not be converted to section symbols, meaning they cannot be used for formatting codes. For formatted text, it's recommended to use Styled Texts.
Operations¶
+ (Addition)¶
str + str: str¶
Adds the two Strings together.
str + txt: txt¶
Adds the String to the Styled Text, outputting a new Styled Text. The Styled Text's formatting will carry over to the String, following the rules of the Inherit Styles tag.
str + num: str¶
Converts the Number into a String and adds it onto the String.