Here is a List< string > lstA;
lstA may contains value(datatype string) like: 1st example
1
1.00
1000.01
1,002.98
.........
Or listA may contain value like: 2nd example
1
1,00
1000,01
1.002,98
.........
i am trying to pass this list to a method and it will return me a string "german" or "us"
I am trying this:
private static string ReturnCulture(List<string> lst)
{
string cull = "";
foreach (string s in lst)
{
if (s.Contains(".") && s.Contains(","))
{
cull = "german";
break;
}
else if (!s.Contains(".") && s.Contains(","))
{
cull = "german";
}
else if (s.Contains(".") && !s.Contains(","))
{
cull = "us";
break;
}
else if (!s.Contains(".") && !s.Contains(","))
{
continue;
}
}
return cull;
}
this works fine as for first 3 value. but when i get (1,002.98) or ("1.002,98") this both fullfils for german condition.
How to solve this? can globalization class easily detect which culture it is? the given example of lstA is realy random. but it will be either as 1st example or the 2nd.