Splitting the string array into array characters. (not as simple as it seems)

Hi Team,
@aksh1yadav, @ovi, @vvaidya, @andraciorici, @badita, @arivu96, @ClaytonM, @ddpadil, @Dominic, @Susana,

As per my project, I am using “SAP GUI interface”. As I am trying to extract the values from excel like interface (which has cells as shown in the below figure).


Note:- “For each row activity” cannot be used into this SAP GUI interface.

I need only two values into two variables- (2,406,289,170.66) and (503,145,385.61) from the image above.

While I am using (Ctrl - C) and (right,down, up, left ) hotkeys to traverse through the cells and extract values, the entire row is being stored in the string variable instead of getting only one cell value.

Anyways, I tried to split the entire row (which is being extract) using string array variable like:-
strArGrandTotalRow = GrandTotalRow.ToString.trim.Split(" ".ToCharArray)

and trying to print the strArGrandTotalRow(0), entire row is being printed.Data%20Extraction

As I am printing the clipboard value into notepad, I am getting string as shown above.
I also tried, strArGrandTotalRow = GrandTotalRow.ToString.trim.Split("\t".ToCharArray)

But still it won’t work.

Kindly Help.

Thanks and Regards,
@hacky

Can you share the txt file or the number as copy paste in quote you are getting!!! I am assume you want the 1st and the 3rd numerical value only ?

@Shubham_Varshney
I tried to copy the string here.
Yes, you are right, I want only 1st and 3rd value.

	2,406,289,170.66	1,903,143,785.05	503,145,385.61

But here, it does not show as I expected.

@Shubham_Varshney,

OR, Please let me know the REGEX, which can help me split the string as per requirement,

like \d\d\d,\d\d\d.\d\d

I am not good at creating robost regex.

@Shubham_VarshneyRegards,
@hacky

Hi @hacky try this may be it help you

  1. trim the entire string

  2. split using below code then take array(0) and array(3)
    system.Text.RegularExpressions.Regex.Split(InputString,"\s{1,}")

  3. array(0) array(3)

Try bellow pattern
[\d|,|.]*

@hacky

I am not using a regex expression, but this will work if the spaces are consistent

text1 = text.Split({" "},StringSplitOptions.None)

I stored the number you gave me in text variable
Now to get the first and the last number, all you need to do is text1(1) and text1(3)

Hope this helps you