On Monday, 9 November 2020 at 18:55:44 UTC, Ali Çehreli wrote:
On 11/9/20 9:53 AM, k2aj wrote:
> string text = "welcome2worldinfo";
> string hg = toUpper(text[0..7] ~ "-" ~ text[7..8] ~ "-" ~
text[8..13]);
If those concatenations with the ~ operators prove to be costly
at runtime, the following range expression may be faster
because it does not allocate any memory:
import std.string;
import std.range;
import std.algorithm;
import std.stdio;
void main() {
string text = "welcome2worldinfo";
auto hg = chain(text[0..7], only('-'), text[7..8], only('-'),
text[8..13]).map!toUpper;
writeln(hg);
}
Ali
Hi Both,
Thank you very much, your solution resolved our issue.