A better way than foreach with this?

Joel via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Aug 24 00:05:22 PDT 2015


On Monday, 24 August 2015 at 06:13:50 UTC, Jacob Carlborg wrote:
> On 2015-08-24 07:58, 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, "_", " ");
>>
>
> Why not call the "replace" function directly on "names"?

They would split wrong.



More information about the Digitalmars-d-learn mailing list