Substring/Top and tail: Difference between revisions

Add Neko
(Added COBOL, tested with GnuCOBOL)
(Add Neko)
Line 1,036:
str(2:end-1)
</lang>
 
=={{header|Neko}}==
Neko strings are mutable, fixed length buffers. The '''$ssize''' builtin uses the allocated size, not any internal sentinel terminator byte. With literals, the allocated size is the size of the literal as it appears in source code, i.e. no NUL byte appended.
 
'''$ssub''' ''sub-string'' takes string, position (zero-relative), length arguments.
<lang ActionScript>/**
Subtring/Top-Tail in Neko
*/
 
var data = "[this is a test]"
var len = $ssize(data)
 
$print(data, "\n")
$print($ssub(data, 1, len - 1), "\n")
$print($ssub(data, 0, len - 1), "\n")
$print($ssub(data, 1, len - 2), "\n")</lang>
 
{{out}}
<pre>prompt$ nekoc toptail.neko
prompt$ neko toptail.n
[this is a test]
this is a test]
[this is a test
this is a test</pre>
 
=={{header|Nemerle}}==
Anonymous user