remove value from given collection
Parameters
remove collection :string :literal :dictionary :block
value :any
Attributes
key | | remove dictionary key |
once | | remove only first occurence |
index | | remove specific index |
prefix | | remove first matching prefix from string |
suffix | | remove first matching suffix from string |
instance | | remove an instance of a block, instead of its elements. |
Returns
- :string
- :dictionary
- :block
- or :nothing
Examples
copy
remove "hello" "l" ; => "heo"
print "hello" -- "l" ; heo
copy
str: "mystring"
remove 'str "str"
print str ; mying
copy
print remove.once "hello" "l"
; helo
; Remove each element of given block from collection once
remove.once [1 2 [1 2] 3 4 1 2 [1 2] 3 4] [1 2]
; [[1 2] 3 4 1 2 [1 2] 3 4]
copy
remove [1 2 3 4] 4 ; => [1 2 3]
copy
remove.instance [1 [6 2] 5 3 [6 2] 4 5 6] [6 2] ; => [1 5 3 4 5 6]
remove.instance.once [1 [6 2] 5 3 [6 2] 4 5 6] [6 2] ; => [1 5 3 [6 2] 4 5 6]
Related