cancel
Showing results for 
Search instead for 
Did you mean: 

To extract each digit from a number data item

MayankSinha1
Level 2
I am creating a process Toto check for Armstrong's Number, where one need to extract each digit from a number data item in order to do the following calculation
 
Amstrongnumber
Ex:- 345
If sum of (3*3*3) + (4*4*4) + (5*5*5) = 345

------------------------------
Mayank Sinha
------------------------------
1 REPLY 1

Hi Mayank,

Here are two ways you could do this:

Option 1:
Using Utility - Strings VBO, Split Lines by Length and set maximum line length to 1. The input value has to be text data type for this to work.

Option 2:
Get the length of the integer with the Len() text function.
Then use the Mid text function to iterate through the data item with length set to 1 character. Start with the first character and stop when you have reached the last character (which is the same as the length).

You would also need to check if it's a negative integer and disregard the minus sign.

------------------------------
Patrick Aucoin
Senior Product Consultant
Blue Prism
------------------------------