Questions tagged [cultureinfo]

Represents information about a specific culture including the names of the culture, the writing system, and the calendar used, as well as access to culture-specific objects that provide information for common operations, such as formatting dates and sorting strings.

Represents information about a specific culture including the names of the culture, the writing system, and the calendar used, as well as access to culture-specific objects that provide information for common operations, such as formatting dates and sorting strings.

Reference

CultureInfo on MSDN

1135 questions
9
votes
2 answers

CA1305: int.Parse(String)

I am getting a CA1305 Warning. Microsoft.Globalization : Because the behavior of 'int.Parse(string)' could vary based on the current user's locale settings, replace this call in '_Default.CalculateImageButton_Click(object, …
niaher
  • 9,460
  • 7
  • 67
  • 86
9
votes
2 answers

Strange results from IndexOf on German string

I have string "Ärger,-Ökonom-i-Übermut-ẞ-ß" and when I run IndexOf("--") I get a result of 23. If I use Replace on same string nothing gets replaced. I don't understand what is happening, so can someone please shed some light on this issue?…
Antonio Bakula
  • 20,445
  • 6
  • 75
  • 102
9
votes
2 answers

How to determine if a CultureInfo instance supports Latin characters

Is it possible to determine if the CultureInfo instance that I am working with is based on a Latin character set or not?
januszstabik
  • 1,152
  • 5
  • 16
  • 30
9
votes
7 answers

Browser language: autodetect vs user select?

I am designing a localized web app. I am leaning on auto-detect browser language setting. But I notice a number of respectable sites asking the user to select a language. Is there any usability issue you know of (from actual experiences out there)…
Pita.O
  • 1,864
  • 1
  • 19
  • 27
9
votes
2 answers

Persian Calendar not valid with CultureInfo

What's wrong with this code? Error(Exception) message : Not a valid calendar for the given culture. System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("fa-Ir"); //Error ci.DateTimeFormat.Calendar = new…
ramezani.saleh
  • 571
  • 2
  • 8
  • 17
9
votes
4 answers

Convert number into culture specific

I have a number like 202667.4. I want to convert this to number based on culture. For Ex: In "de"(German) the number should be in 202.667,40. Any help will be greatly appreciated. Thanks.
Manikandan Ram
  • 211
  • 1
  • 4
  • 12
9
votes
3 answers

Difference between Convert.ToDouble and double.Parse in correlation with InvariantCulture

I am wondering why this is working: doubleValue = double.Parse(input[0].ToString(System.Globalization.CultureInfo.InvariantCulture).Replace(',', '.'), System.Globalization.CultureInfo.InvariantCulture); while this isn't: doubleValue =…
Essigwurst
  • 555
  • 10
  • 24
9
votes
3 answers

String.Format not converting integers correctly in arabic

I have a problem with String.Format. The following code formats the string correctly apart from the first integer. Current culture is set to Iraqi arabic (ar-IQ): int currentItem= 1; string of= "من"; int count = 2; string formatted =…
Ken Jackson
  • 163
  • 3
  • 6
9
votes
2 answers

How to specify format culture in a XAML converter

When we use static double values in XAML, how can we specify in which format they are provided? Example:
Dani
  • 2,602
  • 2
  • 23
  • 27
8
votes
3 answers

Why does TryParseExact require CultureInfo if I specify the exact structure?

Looking at DateTime.TryParseExact(dateString, "M/d/yyyy hh:mm:ss tt", CultureInfo.InvariantCulture, 0, out dateValue) I supplied the exact structure to look for : M/d/yyyy hh:mm:ss tt Question If so , Why should I need…
Royi Namir
  • 144,742
  • 138
  • 468
  • 792
8
votes
4 answers

Parsing three-letter language names as culture info

I'm working with an API that returns some information about audio streams in a file, more specifically the audio language in its three-letter ISO name (ISO 639-2) representation. I would like to parse this information into a new CultureInfo object,…
Steven Liekens
  • 13,266
  • 8
  • 59
  • 85
8
votes
2 answers

How to receive event when user changes system's culture

When my application run with a specified culture. Don't close the application, user changes system's culture, ex: change number decimal separator from "." to ",". How to my application can catch this event. Thanks. Notes: C# 2.0, Windows Form.
Leo Vo
  • 9,980
  • 9
  • 56
  • 78
8
votes
2 answers

Why does ReSharper warn at Char.ToString() when not specifying CultureInfo explicitly?

I was wondering why ReSharper does warn me, when I'm trying to convert a char to a string without giving a specific culture info. Is there any case, where it could be converted differently on two systems? Example: var str = ' '.ToString(); The…
Jannik
  • 2,310
  • 6
  • 32
  • 61
8
votes
6 answers

Replace dot(.) with comma(,) using RegEx?

I am working on a C# application. I want to change number decimal figure with comma(,) where i have dot(.) using regular expression. For example: Price= 100,00.56 As this international rule of representing numeric values but I Sweden they have…
Mohsin JK
  • 561
  • 2
  • 8
  • 18
8
votes
5 answers

Default number format for ToString

Is it possible to define a default number format that is used whenever I convert an integer (or double etc.) to a String without specifying a format string? C# example: int i = 123456; string s = "Hello " + i; // or alternatively with string.Format…
fero
  • 6,050
  • 1
  • 33
  • 56