Replace deprecated functions from std_conv and std_uri

This commit is contained in:
Eduard Staniloiu 2017-05-21 18:52:21 +03:00
parent 54385cd6ea
commit 2ffe350c96
2 changed files with 12 additions and 10 deletions

View file

@ -2135,12 +2135,12 @@ Lerr:
///
@safe pure unittest
{
import std.string : munch;
import std.string : tr;
string test = "123 \t 76.14";
auto a = parse!uint(test);
assert(a == 123);
assert(test == " \t 76.14"); // parse bumps string
munch(test, " \t\n\r"); // skip ws
test = tr(test, " \t\n\r", "", "d"); // skip ws
assert(test == "76.14");
auto b = parse!double(test);
assert(b == 76.14);

View file

@ -316,11 +316,12 @@ if (isSomeChar!Char)
string decode(Char)(in Char[] encodedURI)
if (isSomeChar!Char)
{
// selective imports trigger wrong deprecation
// https://issues.dlang.org/show_bug.cgi?id=17193
static import std.utf;
import std.utf : encode;
import std.algorithm.iteration : each;
auto s = URI_Decode(encodedURI, URI_Reserved | URI_Hash);
return std.utf.toUTF8(s);
char[] r;
s.each!(c => encode(r, c));
return r;
}
/*******************************
@ -331,11 +332,12 @@ if (isSomeChar!Char)
string decodeComponent(Char)(in Char[] encodedURIComponent)
if (isSomeChar!Char)
{
// selective imports trigger wrong deprecation
// https://issues.dlang.org/show_bug.cgi?id=17193
static import std.utf;
import std.utf : encode;
import std.algorithm.iteration : each;
auto s = URI_Decode(encodedURIComponent, 0);
return std.utf.toUTF8(s);
char[] r;
s.each!(c => encode(r, c));
return r;
}
/*****************************