_aApplywc1

Loop over a string while changing the UTF encoding

There are 6 combinations of conversions between char, wchar, and dchar, and 2 of each of those.

The naming convention is as follows:

_aApply{c,d,w}{c,d,w}{1,2}

The first letter corresponds to the input string encoding, and the second letter corresponds to the target character type.

- c = char - w = wchar - d = dchar

The 1 variant only produces the character, the 2 variant also produces a loop index.

extern (C)
int
_aApplywc1
(
scope const(wchar)[] aa
,)

Parameters

aa const(wchar)[]

input string

dg dg_t

foreach body transformed into a delegate, similar to opApply

Return Value

Type: int

non-zero when the loop was exited through a break

Examples

void main()
{
    string str;
    wtring wstr;
    dstring dstr;

    foreach (dchar c; str) {}
    // _aApplycd1

    foreach (wchar c; dstr) {}
    // _aApplydw1

    foreach (i, wchar c; str) {}
    // _aApplycw2

    foreach (wchar w; wstr) {}
    // no conversion
}

Meta