The Idea:
Use regex to detect the format
With the help of Regex Groupname we calculate the CultureInfo
we do see 10 000.00 as uncatched (currently no matching Culture Info is known)
Extreme Check
But (we can cross safe if needed) when removing space we can simplify
Prototypes:
Add namespaces:
Get Matching Group Name (unoptimized ProtoType)
if no or more Group names were found the Single() method throws an exception
use the calculated info and parse it with the corresponding CultureInfo
Variables:
Flow with Testseries:
myMatch = myRegex.Match(item.replace(" ",""))
myGroupName = myRegex.GetGroupNames.Skip(1).Where(Function (x) myMatch.Groups(x).Success).Single
myDouble = Double.Parse(item.Replace(" ",""), dictCultureLK(myGroupName))
Logs:
This is one of many options focussing on extensibility and control
Find starter help here:
DoubleParsing_MultiNationalFormats.xaml (9.2 KB)