remove

--

remove value from given collection


Parameters

remove collection :string :literal :pathliteral :dictionary :object :block
       value :any

Attributes

keyremove dictionary key
onceremove only first occurence
indexremove specific index
prefixremove first matching prefix from string
suffixremove first matching suffix from string
instanceremove 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