Hello everyone I am trying to compare the values based on “#” and get the least value among them.
There are 4 items in the string and with the prefix “#” there are two values 0.685 g and 2.65 g.
Input String:-“# 0.685 g % 1.57 g # 2.65 g % 3.8 g”
Output Value:- 0.685 g
I think, you can split the values using the character “g” from the string because this character is there after each value.
So, split the string based on this as follows
InputString.Split("g"c)
This will create an string array with all the split values.
Next, use a for each activity and loop through the array of items.
Withn the loop, use string replace function to replace the special characters “%” and “#” from the items and add them to a List collection using add to collection activity
Now you will have a clean list of items that contain only the numbers. Now you, use List.Sort() option to sort the list in ascending order.
Next, get the maximum item from the list and you will have the highest value.
Hello @saneeth_kandukuri
You can do the way as suggested by Lahiru.Fernando
Or
you can use another quick way by using Regex and Min method by assigning this code to a String Datatype variable
String.Join(",",System.Text.RegularExpressions.Regex.Matches(Strrr,"\d+\.\d+|\d+").Cast(of Match)).Split(","c).Min
You Just have to assign this code to a string variable
What this code does is it’ll take all the number using regex and then compare all the numbers using Min Method
Check this workflow for better understanding
Compare value.zip (13.2 KB)