Jump to content

Substring/Top and tail: Difference between revisions

PascalABC.NET
(Add Ecstasy example)
(PascalABC.NET)
 
Line 1,725:
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.
 
=={{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}}==
179

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.