left, right. Getting substring on the left and on the right

These methods return N first or last characters of the string respectively. If value of N is more than the string's length, the method will output the whole string.

Example

$str[Strangers in the night…]
^str.left(7) ^str.right(9)


The code will output:
Strange night


Copyright © 1997–2010 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 21.09.2007