mirror of
https://github.com/dlang/phobos.git
synced 2025-04-27 13:40:20 +03:00
Replace deprecated functions from std_conv and std_uri
This commit is contained in:
parent
54385cd6ea
commit
2ffe350c96
2 changed files with 12 additions and 10 deletions
|
@ -2135,12 +2135,12 @@ Lerr:
|
||||||
///
|
///
|
||||||
@safe pure unittest
|
@safe pure unittest
|
||||||
{
|
{
|
||||||
import std.string : munch;
|
import std.string : tr;
|
||||||
string test = "123 \t 76.14";
|
string test = "123 \t 76.14";
|
||||||
auto a = parse!uint(test);
|
auto a = parse!uint(test);
|
||||||
assert(a == 123);
|
assert(a == 123);
|
||||||
assert(test == " \t 76.14"); // parse bumps string
|
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");
|
assert(test == "76.14");
|
||||||
auto b = parse!double(test);
|
auto b = parse!double(test);
|
||||||
assert(b == 76.14);
|
assert(b == 76.14);
|
||||||
|
|
18
std/uri.d
18
std/uri.d
|
@ -316,11 +316,12 @@ if (isSomeChar!Char)
|
||||||
string decode(Char)(in Char[] encodedURI)
|
string decode(Char)(in Char[] encodedURI)
|
||||||
if (isSomeChar!Char)
|
if (isSomeChar!Char)
|
||||||
{
|
{
|
||||||
// selective imports trigger wrong deprecation
|
import std.utf : encode;
|
||||||
// https://issues.dlang.org/show_bug.cgi?id=17193
|
import std.algorithm.iteration : each;
|
||||||
static import std.utf;
|
|
||||||
auto s = URI_Decode(encodedURI, URI_Reserved | URI_Hash);
|
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)
|
string decodeComponent(Char)(in Char[] encodedURIComponent)
|
||||||
if (isSomeChar!Char)
|
if (isSomeChar!Char)
|
||||||
{
|
{
|
||||||
// selective imports trigger wrong deprecation
|
import std.utf : encode;
|
||||||
// https://issues.dlang.org/show_bug.cgi?id=17193
|
import std.algorithm.iteration : each;
|
||||||
static import std.utf;
|
|
||||||
auto s = URI_Decode(encodedURIComponent, 0);
|
auto s = URI_Decode(encodedURIComponent, 0);
|
||||||
return std.utf.toUTF8(s);
|
char[] r;
|
||||||
|
s.each!(c => encode(r, c));
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************
|
/*****************************
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue