A better way than foreach with this?

ted via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Aug 23 23:17:07 PDT 2015


try:
  auto names1 = names.map!( a => replace(a, "_"," "));

...not sure how to do it in-place though.

Joel wrote:

> auto names =
> "Alef Bet Gimel Dalet He Vav Zayen Het Tet Yod Final_Kaf "
> "Kaf Lamed Final_Mem Mem Final_Nun Nun Samekh Ayin Final_Pe "
> "Pe Final_Tsadi Tsadi Qof Resh Shin Tav".split;
> 
> foreach (ref name; names)
> name = replace(name, "_", " ");
> 



More information about the Digitalmars-d-learn mailing list