On Tuesday, 18 July 2017 at 15:41:44 UTC, Meta wrote:
On Tuesday, 18 July 2017 at 15:28:06 UTC, Antonio Corbi wrote:
Hi all,
I'm trying dmd-2.075.0-rc1 in one of my projects where I use
`squeeze` and `removechars`. Both of them are flagged as
obsolete and in the docs we are suggested to use functions
from std.regex and/or std.algorithm.
Does any one kow a one-liner from std.regex or std.algorithm
that can take the role of those deprecated functions?
Thank's
A. Corbi
As Seb somewhat undiplomatically put, there are replacements
listed in the changelog.
Use std.regex.replaceAll to replace std.string.removechars:
import std.string;
import std.regex;
// old
"abc".removechars("a-z");
// new
"abc".replaceAll(regex("[a-z]"), "");
Use std.algorithm.iteration.uniq to replace std.string.squeeze:
import std.algorithm;
import std.string;
// old
"hello".squeeze;
// new
"hello".uniq;
Though it would be nice to have these alternatives listed right
there in the deprecation message.
Thanks Meta and Seb!
Yes, the replacement is there 8), but as the deprecation message
told me "to go to the docs", I only had in mind the library
manual pages and not the changelog.
I agree with you that, at least, they could also be listed next
to `squeeze` and `removechars`.
Thanks for your help!
A. Corbi