Power Automate Flow that return numbers on a text
Have you had this kind of requirement? Where you have to get all the numbers that exist on a text.
I recently created a child flow with Power Automate that does this in 11 seconds.
First, you must create a variable to append all numbers in this string.
split(replace(replace(triggerBody()['text'],',',''),'$',''),' ')
Next, per each record, you will validate if it is an int or float number, and if yes, it will be appended to the variable.
if(or(isFloat(item()),isInt(item())),concat(item(),'|'),'')
Finally, remove the last string that concatenates each number "|" and return it as the flow result.
substring(variables('numbers'),0,sub(length(variables('numbers')),1))
The expected result of the following input is: "4|4.59|2"
Comments
Post a Comment