Substring/Top and tail: Difference between revisions
Content deleted Content added
Add Ecstasy example |
PascalABC.NET |
||
Line 1,725: | Line 1,725: | ||
end |
end |
||
end.</syntaxhighlight>It is imperative that <tt>firstCharacterIndex + substringLength</tt> specified to <tt>subStr(source, firstCharacterIndex, substringLength)</tt> must be valid index in <tt>source</tt>. Therefore you need to perform checks beforehand. |
end.</syntaxhighlight>It is imperative that <tt>firstCharacterIndex + substringLength</tt> specified to <tt>subStr(source, firstCharacterIndex, substringLength)</tt> must be valid index in <tt>source</tt>. Therefore you need to perform checks beforehand. |
||
=={{header|PascalABC.NET}}== |
|||
<syntaxhighlight lang="delphi"> |
|||
{$zerobasedstrings} |
|||
begin |
|||
var s := '0123456789'; |
|||
Writeln(s[1:]); |
|||
Writeln(s[:^1]); |
|||
Writeln(s[1:^1]); |
|||
end. |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
123456789 |
|||
012345678 |
|||
12345678 |
|||
</pre> |
|||
=={{header|Perl}}== |
=={{header|Perl}}== |