Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a TrimmedString.trim method #487

Closed
wants to merge 2 commits into from

Commits on Apr 26, 2018

  1. Add a TrimmedString.trim method

    This is somewhat similar to `FiniteStringOps.truncate` in that it's
    guaranteed to turn any `String` into a `TrimmedString`.
    
    There are some funny characters that get removed by `String.trim` but
    don't match on `\s` in regular expressions. I've added an example to
    demonstrate that these characters can lead to a `String` being "trimmed"
    a bit more than would technically be necessary to match the
    `TrimmedString` regex.
    ceedubs committed Apr 26, 2018
    Configuration menu
    Copy the full SHA
    0b6ab12 View commit details
    Browse the repository at this point in the history
  2. Adjust TrimmedString regex

    This should now match up with the strings that `String.trim` produces.
    I had to change `.*` to `(?s:.*)` because the line separator character
    isn't removed by `trim` yet doesn't match `.*` without the `s` flag, so
    a string like `"\u2028"` can be the result of `trim` but didn't
    previously match the regular expression.
    
    Scalastyle and scalafmt had some competing opinions on how I should
    format this long regex Witness expression.
    ceedubs committed Apr 26, 2018
    Configuration menu
    Copy the full SHA
    9a9a877 View commit details
    Browse the repository at this point in the history