Ruby

Strings

There is no substring method in Ruby.  We must rely on ranges and expressions.

Example:
# Index 0 = c
# Index 1 = r
# Index 2 = u
# Index 3 = s
# Index 4 = t

value = "crust"

# Get substring at indexes 0 through 3.
sub1 = value[0..3]

# Get substring at indexes 3 through 4.
sub2 = value[2..3]

# Get substring past index three through end of string.
sub3 = value[3..-1]

puts sub1
puts sub2
puts sub3

# Output

crus
us
st