2

Is it possible to concatenate integers without converting to String first?

int _test1 = 123;
int _test2 = 456;

print(int.parse(("$_test1"+"$_test2"))); // 123456
Mr Jax
  • 957
  • 12
  • 22

1 Answers1

3

you can do it like this

void main() {
    int _test1 = 123;
    int _test2 = 456;
    int pow = 10;
    while(_test2 >= pow)
        pow *= 10;
  print(_test1 *pow + _test2);
}

source : How to concatenate two integers in C

laserany
  • 1,257
  • 1
  • 8
  • 17