Try catch question converting string with letters (13k) to integer

catch
try

Hey guys, I have a string that I want to convert to integer, but some strings have a letter on it like (13k). How would I make it so if the “convert string to integer is not valid” error appears, I want to move on to the next item?

Cint(“13K”.replace(“K”,“000”))

Please mark as solution if found useful

1 Like

Hi @Marcos_Jeremiah_Kenn_T,

I understand you are using a loop. Some rows in this loop are denoted by k instead of 1000. That’s why convert gives an error.

You can use an earlier condition if you want to move to the next one in the catch.

image

Regards,
MY

1 Like

Regex can help (import System.Text.RegularExpressions to the namespaces, imports panel)
when we only have XXXk or XXXK values
grafik

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