.\" This man page is automatically generated using .\" kayadoc2man from the Kaya development tools and the -xmldocs compile .\" option. Editing it directly is not encouraged. .\" It is under the same license as the source .k file that it was .\" generated from. .TH "Prelude.substr" "3kaya" "August 2014" "Kaya" "Kaya module reference" .SH "NAME" Prelude::substr \- Return a substring. .SH "SYNOPSIS" .B String substr( \fIString x, Int i, Int len\fP .B ")" .SH "ARGUMENTS" .PP .B "x" The original string .PP .B "i" The starting index .PP .B "len" The substring length .SH "DESCRIPTION" .PP Starting at character \fIi\fP , return the \fIlen\fP characters long substring. Throws an Exception if \fIlen\fP is negative, or if \fIi\fP is out-of-bounds. In Kaya 0.2.4 and earlier, an Exception was also thrown if \fIlen\fP was zero. The empty string is now returned in this case. .PP If the starting index is negative, then it will be counted in characters from the end of the string. .IP "" -4 x = "abcdef"; s = substr(x,0,2); // "ab" s = substr(x,4,1); // "e" s = substr(x,3,10); // "def" ( \fIlen\fP truncated) s = substr(x,-4,2); // "cd" .SH "AUTHORS" Kaya standard library by Edwin Brady, Chris Morris and others (kaya@kayalang.org). For further information see http://kayalang.org/ .SH LICENSE The Kaya standard library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (version 2.1 or any later version) as published by the Free Software Foundation.