String hygiene

I think whitespace is by far the most common thing to be trimmed from a String, and this opinion is supported by the survey quoted in the proposal, so I think there is a strong case for accepting it even without being able to customise the set of Characters. There's a much more involved decision to be made about how to represent sets of Characters generally (e.g. Set<Character> would be a ridiculous way to represent the set of all emoji), how to specify such sets using Character properties, how this relates to other sets that aren't feasible to represent by enumerating all their elements (e.g. sets of integers with particular properties, this ContainmentSet proposal), etc. Once these decisions are made, the solution can be additively adopted by the trim methods at the same time as the other String methods adopt them.

3 Likes