Lasso Soft Inc. > Home

[ map->removeall ]

Method

[map->removeall] removes all matching elements from the map.

With no parameter the map is emptied. Otherwise, the parameter is compared to each key of the map in turn and matching elements are removed.

The parameter can be any data type in Lasso including a matcher. The map is modified in-place and no result is returned.

Note: if the parameter is not a matcher this method behaves exactly like the [map->remove] method

  • Syntax
map->removeall( key_value )
Examples
  • Beginner

Remove a key/value pairs from a map

Use the [map->remove] method. This example removes elements from the 'colours' map whose keys begin with the letter g.

Code

var (colours = map( 'red'='#ff0000',
                     'green' = '#00ff00',
                     'blue' = '#0000ff',
                     'grey' = '#aaaaaa') )

$colours->removeall( match_regexp('^g') )

$colours

Result

map(blue = #0000ff, red = #ff0000)

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft