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
  • 837
  • 9
  • 20

1 Answers1

2

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
  • 904
  • 1
  • 5
  • 15