noredink-ui/src-0.18/Nri/Ui/Util.elm
Richard Feldman e2907d9ba2 Prep for 0.19 dual-publish (#163)
* Use elm-css 16.0.0

* 💀 Ui.Checkbox V1 and V2

* s/Css.Foreign/Css.Global/g

* 💀 Nri.Ui.Styles.V1

* 💀 BannerAlert.V1

* 💀 Modal.V1

* 💀 Dropdown.V1

* 💀 Select.V1 and V2

* 💀 Alert.V1

* 💀 Button.V1 and V2

* 💀 Divider.V1

* 💀 Icon.V1 and V2

* 💀 Outline.V1

* 💀 SegmentedControl.V1-V5

* 💀 TextArea.V1 and V2

* 💀 TextInput.V1

* delete the rest of the modules

* actually more deletions

* InputStyles v1 is unused

* move to src-0.18

* do the 0.19 upgrade

* select options are addressable by index

* elm-css 16

* update scripts

* elm-format

* Update V2.elm

* put the nbsp back

* elm-format validation for both versions
2018-11-12 15:38:19 -08:00

19 lines
498 B
Elm

module Nri.Ui.Util exposing (dashify, removePunctuation)
import Regex
{-| Convenience method for going from a string with spaces to a string with dashes.
-}
dashify : String -> String
dashify =
Regex.replace Regex.All (Regex.regex " ") (always "-")
{-| Convenience method for removing punctuation
(removes everything that isn't whitespace or alphanumeric).
-}
removePunctuation : String -> String
removePunctuation =
Regex.replace Regex.All (Regex.regex "[^A-z0-9\\w\\s]") (always "")