diff options
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/active_support_core_extensions.md | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index 1915252122..fade836873 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -1249,6 +1249,17 @@ Calling `to_s` on a safe string returns a safe string, but coercion with `to_str Calling `dup` or `clone` on safe strings yields safe strings. +### `remove` + +The method `remove` will remove all occurrences of the pattern: + +```ruby +"Hello World".remove(/Hello /) => "World" +``` + +There's also the destructive version `String#remove!`. + +NOTE: Defined in `active_support/core_ext/string/filters.rb`. ### `squish` The method `squish` strips leading and trailing whitespace, and substitutes runs of whitespace with a single space each: |