Split a number into digits and iterate through it

Hi.I am new to outsystems. Can someone suggest how to split a number into individual digits and iterate through it ? Like the conventional d=a%10 ,a=a/10, will it work?Or , is there another specific way to do it? 

Hi ankit!

You could use the Substr() function to split that number. One way of doing it would be Substr(<string variable>,looping count variable,1) then loop it in a ForEach. Use the Length() of that string to count how many the times that loop would go.

Reference:
https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Logic/Built-in_Functions/Text#Substr


Kind regards,
Joseph Enriquez

Joseph Enriquez wrote:

Hi ankit!

You could use the Substr() function to split that number. One way of doing it would be Substr(<string variable>,looping count variable,1) then loop it in a ForEach. Use the Length() of that string to count how many the times that loop would go.

Reference:
https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Logic/Built-in_Functions/Text#Substr


Kind regards,
Joseph Enriquez

Thanks.


Hi Ankit,

First of all welcome to Outsystems!

In attachment you'll find an example of how to split decimal numbers using Substring().
With some small tweaking you can alter it to return just the numbers and skip the delimiters.

If you got any more questions just let me know.

Kind regards,
Glenn