Hello,
a!localVariables( local!number: todecimal(370737340900000.00), /* Replace this with your input number */ local!chunkSize: 7, /* Define chunk size (7 digits) */ local!divisor: 10 ^ local!chunkSize,
local!chunks: {}, /* List to store chunks */
local!x:a!forEach( items: enumerate(ceiling(log(local!number)/log(local!divisor)) + 1), /* Arbitrarily large number to iterate through */ expression:{ local!iteration:enumerate(ceiling(log(local!number)/log(local!divisor)) + 1), local!chunk: mod(local!number, local!divisor), /* Get last 7 digits */ local!number: round(local!number / local!divisor, 0) } ),
/* Reverse the chunks list to maintain the correct order */ reverse(local!chunks))
I want to achieve try to split the big decimal into 7 digit numbers, I want the result in the "local!x" {8765431, 7373409, 370}
I hope the question is clear, let me know how to achieve this.
Discussion posts and replies are publicly visible
a!localVariables( local!text: char( code( "21121212u1i2ui12i1iwjansjnajnsjansnansa" ) ), local!length: 7, local!arrayWithIdentifier: a!flatten( a!forEach( items: local!text, expression: { if( mod(fv!index, local!length) = 0, { fv!item, ";" }, { fv!item } ) } ) ), local!splitData: split(concat(local!arrayWithIdentifier), ";"), local!splitData )