Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -0,0 +1,15 @@
|
|||
; using substring:
|
||||
user=> (subs "knight" 1)
|
||||
"night"
|
||||
user=> (subs "socks" 0 4)
|
||||
"sock"
|
||||
user=> (.substring "brooms" 1 5)
|
||||
"room"
|
||||
|
||||
; using rest and drop-last:
|
||||
user=> (apply str (rest "knight"))
|
||||
"night"
|
||||
user=> (apply str (drop-last "socks"))
|
||||
"sock"
|
||||
user=> (apply str (rest (drop-last "brooms")))
|
||||
"room"
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
(let (str "rosetta")
|
||||
;; strip first char
|
||||
(println (1 str))
|
||||
;; strip last char
|
||||
(println (0 -1 str))
|
||||
;; strip both first and last characters
|
||||
(println (1 -1 str)))
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
/*REXX program to show removal of 1st/last/1st&last chars from a string.*/
|
||||
|
||||
z = 'abcdefghijk'
|
||||
|
||||
say ' the original string =' z
|
||||
|
|
|
|||
|
|
@ -2,3 +2,4 @@ puts "knight"[1..-1] # strip first character
|
|||
puts "socks"[0..-2] # strip last character
|
||||
puts "socks".chop # alternate way to strip last character
|
||||
puts "brooms"[1..-2] # strip both first and last characters
|
||||
puts "与今令"[1..-2] # => 今
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue