Remove the index in array which are not valid numbers

How to remove the index in array which are not valid numbers

I need only the valid int or double values in the string array…

Remove all which are not

@Sweety_Girl Is the Array an Array of Strings ?

Hi @Sweety_Girl

Other than Int and Double what all values do u have in Array can you specify ??

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

Array of String

Eg like… 10abc, 3847\

You can see this… this two are not valid int or double… so we need to remove this

@Sweety_Girl Can you Check this query :

strArray.Where(Function(x)Integer.TryParse(x,Nothing) or Double.TryParse(x,Nothing)).ToArray

It will remove the values in Array which are not Parse-able to Integer or Double.

You would need to assign it back to the array :
strArray = strArray.Where(Function(x)Integer.TryParse(x,Nothing) or Double.TryParse(x,Nothing)).ToArray

2 Likes

Thank you it works!

1 Like

@Sweety_Girl
can you please check and give us feedback
arrDemoValues.Where(Function (x) isNumeric(x)).toArray

Thanks for check and support

1 Like

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