I have this numbers:
uint256 numbers = 123456789;
I need to extract the two first number (12) into uint variable.
Also possibility to extract the next 2 numbers following the previous one: 34
ect.
Is there any easy way to do such thing in solidity ?
I have this function but it is made for strings:
function getSlice(uint256 begin, uint256 end, string text) public pure returns (string) {
bytes memory a = new bytes(end-begin+1);
for(uint i=0;i<=end-begin;i++){
a[i] = bytes(text)[i+begin-1];
}
return string(a);
}
For my case, I want INPUT/OUTPUT numbers will be in UINT256.
Thanks in advance for your help !