English
Chinese
  yTin Online Help  

  Home (english) | Home (chinese) | Downloads | Sample scripts | Online help | Utilities | FAQs | Discussions/Messages | Mud&links | My Progs | Mirrors |
substr

format:         #substr {string} {index1} {length}

Similar to Perl function substr().
Currently is not as smart as Perl yet. Need specify explicitly
0 based index1 and length.
When length is <0, will count from the tail.
Return value is assigned to $_.

example:
#substr {01234567} {3} {4}
will assign {3456} to $_.
#substr {0123456789} {3} {-5}
will assign {34} to $_ since the last 5 {56789} is truncated.

Note: we do not need "strcat" command in yTin, #var {str1} {$str1$str2} will do it.

See also: #strrchr, #strstr, #strncmp, #ord, #chr