wstring double quotes to string double quotes

Joel joelcnz at gmail.com
Thu Apr 19 21:53:52 UTC 2018


I have a program that uses string double quotes, but copies from 
wstring double quotes. The wstring double quotes are in string 
type (sourceTxt is a string with wstring double quotes).

The following code crashes with an array.d(2211): Range violation 
error:

import std.conv : to;
import std.string : replace;

auto sourceTxtW = sourceTxt.to!wstring;
sourceTxtW.replace("”", `"`);
auto sourceTxtR = sourceTxtW.to!string;
sourceLines = sourceTxtR.split("\n");


More information about the Digitalmars-d-learn mailing list