July 10, 2014
On Thursday, 10 July 2014 at 15:51:11 UTC, Olivier Pisano wrote:
> Hello,
>
> I may have not understood what you actually want to do, but
> aren't std.bitmanip.peek or std.bitmanip.read what you are
> looking for ?
>
> http://dlang.org/phobos/std_bitmanip.html#.peek

std.bitmanip.peek and std.bitmanip.read will do nicely should of looked more closely
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;
}
July 10, 2014
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;
}
```
1 2
Next ›   Last »