Convert string to Int - 1000 separator


I’ve tried google my way to a solution, but I keep getting a format error.

In my workflow I use “Get Text” and retrieves like “4.815,77” and “4.815,78” - I would like to convert these two strings to integers and the have the two numbers deducted from each other and make an True/False going true when the numbers is less than 1.

Iv’e tried Cint and Convert.ToInt32, but it gives me a format error.

Hi @Michaeljep

Let’s assume that strExtractedNumbers is the variable that holds the output of Get Text.
Use the condition below in an If activity
(Convert.ToInt32(Split(strExtractedNumbers, ",")(0)) - Convert.ToInt32(Split(strExtractedNumbers, ",")(1))) < 1


is this the actual value

Cheers @Michaeljep

Iv’e tried changing the the strings to the two strings I would like to have compared, but the IF gives me a “Input string was not in correct format”

Yes, the first string is a Get Text from MS Business Central, and the other is a Get Text from a webpage - I would like to check that the two numbers is less than 1 euro from each other.

Hi @Michaeljep

Check this out_str=math.Round(Convert.ToInt32(in_str),2)

based on tat u can check it

Ashwin S


Use below code


strValue = “4.815,77”

intValue = cint(String.Join(“”, strValue.Split({“,”,“.”}, StringSplitOptions.None)))

Result Integer = 481577

StringToInt.xaml (4.3 KB)

Or if you wanted to keep it as a decimal…

strValue1= “4.815,77”

strValue2 = “4.815,78”

intResult = cint(strValue1.Replace(“,”,“”)) - cint(strValue2.Replace(“,”,“”))

If intResult < 1 Then
intResult.ToString + " is less than 1."
intResult.ToString + " is more than 1."

StringToInt.xaml (5.5 KB)

Hi all

I solved it by removing both the . and the ,

By that I got a bigger number than I originally expected, but it can be Cint to and Integer and compared in the IF statement.

Thx for alle your help.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.