String Formatting
See String Interpolation. Here's a quick example:
firstname = "First"
lastname = "Last"
print "Your name is ${firstname} ${lastname}."
print "Now is ${date.Now}."
ToString() method
To convert a class or a type to a string, call the ToString() method. Or if you are writing your own class you can define your own ToString() method to control how your class is printed.
Converting from int to string and back
val as int
val = int.Parse("1000")
print val
pi as double
pi = double.Parse("3.14")
print pi
s as string
s = val.ToString()
print s
astr as string
astr = "${val} and ${pi}"
print astr
d as date
d = date.Parse("03/13/04")
Parsing and converting other types
See this tutorial on the Parse and Convert techniques, as well as date parsing.
String Comparisons
if "asdf" == "ASDF":
print "asdf == ASDF"
else:
print "asdf != ASDF"
if string.Compare("asdf", "ASDF", true) == 0:
print "case-insensitively the same"
s = "Another String"
if s.StartsWith("Another"):
print "starts with 'Another'"
if s.EndsWith("String"):
print "ends with 'String'"
print "'String' starts at:", s.IndexOf("String")
print "The last t is at:", s.LastIndexOf("t")
words = @/ /.Split(s) for word in words:
print word
See the .NET reference on Basic String Operations for more information on string comparisons.