Order strings by percentage in the string

Hi all, after data scraping from website http://www.google.com/finance, the Word market table only, I got a list of strings as follows:
Column1
“.DJI
27,046.23
Dow Jones Industrial Average
−140.46 (0.52%)”
“DAX
12,921.19
DAX PERFORMANCE-INDEX
+54.40 (0.42%)”
“SENSEX
40,179.12
BSE SENSEX
+50.07 (0.12%)”
“UKX
7,272.77
FTSE 100 Index
+24.39 (0.34%)”
“IB
9,282.00
IBEX 35
+24.50 (0.26%)”

How can I sort them by percentage?

if you know the delimiters you can split that string into an array and then add that array as a datarow then do sorting via datatable functions.

1 Like

Hi,

Can you try the following?

dt=dt.AsEnumerable.OrderBy(function(r) CType(System.Text.RegularExpressions.Regex.Match(r(0).ToString,"[\d.]+(?=%)").ToString,double)).CopyToDataTable

Regards,

1 Like

Thank you very much!

1 Like

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