Substring/Top and tail: Difference between revisions

Content added Content deleted
(Add Logtalk implementation)
(→‎{{header|Lasso}}: Added Lasso string remove examples)
Line 529: Line 529:
julia> chop("My String") #alternate remove last character
julia> chop("My String") #alternate remove last character
"My Strin"</lang>
"My Strin"</lang>


=={{header|Lasso}}==
<lang Lasso>local(str = 'The quick grey rhino jumped over the lazy green fox.')

// String with first character removed
string_remove(#str,-startposition=1,-endposition=1)
// > he quick grey rhino jumped over the lazy green fox.

// String with last character removed
string_remove(#str,-startposition=#str->size,-endposition=#str->size)
// > The quick grey rhino jumped over the lazy green fox

// String with both the first and last characters removed
string_remove(string_remove(#str,-startposition=#str->size,-endposition=#str->size),-startposition=1,-endposition=1)
// > he quick grey rhino jumped over the lazy green fox</lang>


=={{header|Logo}}==
=={{header|Logo}}==