Types/String

From SC2Mapster Wiki
Jump to: navigation, search

String

  • String represents textual data.
// String literal
string website = "sc2galaxy";
// String concatenation
string url = "http://www." + website + ".com/";
string sc2 = "sc2";
sc2 += "galaxy"; // "sc2galaxy"
// String equality is case senstive
bool eq = (website == url); // false
eq = ("sc2galaxy" == "sc2" + "galaxy"); // true
eq = ("SC2GALAXY" == "sc2galaxy"); // false
eq = StringEqual("SC2GALAXY", "sc2galaxy", false); // true
  • Note: Operators <, <=, > and >= always return true.
"a" < "A" // true
"A" < "a" // true
  • Note: Individual character access is not available through []
string sc2 = "sc2galaxy";
char c = sc2[1];
// Implicit cast not allowed
string c = sc2[1];
// Implicit cast not allowed
  • Note: There is no way to get character access or string length. Only string equality (case sensitive or not) and split into separate words are available.

Related Functions

Manipulating Strings

Converting Strings