How to trim string inside an array

I have an array like below:
arr= { “2 2”, “89”, “88” }

I need to trim the values so that I should get like- { “22”, “89”, “88” }
I need to convert to Integer where its getting failed because of space.
For converting integer have used the below code, but all of sudden code is failed:

arrInt= Array.ConvertAll(arr, function(str) cint(str.trim))

Please suggest.

1 Like

Hi,

Can you try the following expression?

arr = arr.Select(Function(s) s.Replace(" ","")).ToArray()

Regards,

1 Like

looks like, its the glitch in OCR extractor (tessrract ocr)i am using. till now its was giving accurate result.

Question should be= “Which is the Middle No. ? 2, 37,42=”
But extractor result i got= “Which is the Middle No. 2 2, 37,42=”

Thats why its failing for the following commands used.

Any solution to extract only the numbers and that should be arr of intergers so that I can use the other action for math calculations.

Thanks!

I have used it, this works.

But I found the main glitch in OCR extractor, instead of '?’ its taking '2’, so the result is not coming correct.

Any suggestion how to extract only for numbers from the whole string.

ex: string= “What is the first no. ? 2,23, 45 =”

Output should be in arr= {2,23,45}

TIA

Hi,

How about the following?

arr = System.Text.RegularExpressions.Regex.Match(yourString,"\d[\s\d.,]*").Value.Replace(" ","").Split(","c)

Regards,

Hi @Ranjit_Nayak1 please check this workflow:
ConvertArrayStringToInteger.zip (1.7 KB)

Hello Everyone,

Thanks for all your valuable input.

This is solely issue with the tesseract OCR which i am using with Get OCR Text activity.

So If there is a way of another free ocr to capture captcha image kindly suggest!

Hey

please give a try with the omnipage OCR

Regards

1 Like

Yes, I have already implemented, this works perfect.

Thanks for your input.

1 Like

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