SHIP:Data Types:String

From Serious Documentation
Revision as of 05:10, 19 April 2014 by Admin (talk | contribs) (Examples)
Jump to: navigation, search

See Also

String

Stings in SHIP are a sequence of UTF8 characters terminated in an implicit end-of-string character.

Data Type Description
String A sequence of UTF8 characters terminated in an implicit end-of-string character.

Examples

String constants are written in Sail Scripts enclosed in double quotes ("), for example

 text.value = "hello";

and can be concatenated with the "+" operator, for example

 text.value = "hello" + " " + "there";

Within Sail Scripts you can access the Unicode codepoints within a string, access portions of the string, and more using the Sail String Functions.

You can define strings with alternate language translations using string and text nodes. These translated string resources can be combined at runtime in Sail scripts to form larger strings, for example if you have a string resource:

tWelcome
  enUS: Welcome
  frFR: Bienvenue

a Sail script can combine these using simple concatenation:

text.value = tWelcome + " Terry";