S2 Cookbook: Strings

From Dreamwidth Notes
Revision as of 07:33, 17 June 2010 by Foxfirefey (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Get the length of a string

var string x = "stylish";
# Get the length of our example string
var int length = $x->length();
# Print out what the length is
print """The length of "$x" is $length."""

Will print out:

The length of "stylish" is 7.

Finding a string in another string

var string foxy = "I am a quick brown fox.";

Changing the case of a string

Comparing two strings to see if they are equal or not equal

Comparing two strings lexographically

Splitting a string into pieces

Repeating a string