On Thursday, 10 July 2014 at 17:30:17 UTC, Sean Campbell wrote:
if I need to Concatenate ints I'l just use a recursive pow based on length

int ConcatInt(int[] anint){
        int total = 0;
        for(int i=0;i<anint.length;i++){
                total += anint[i]*10^^(anint.length-i-1);
        }
        return total;
}

With `foreach_reverse` it looks a little better:

```d
int concat_ints(int[] ints)
{
        int result;

        foreach_reverse (i, int_; ints) {
                result += int_ * 10 ^^ (ints.length - i - 1);
        }

        return result;
}
```

Reply via email to