For converting an integer to string in C# (with invariant culture), we do something like below:
int num = 123;
string numAsString = num.ToString(CultureInfo.InvariantCulture);
Is there an equivalent of the above operation in Java or does Integer.toString(int)
inherently does culture invariant conversion?
or does
Integer.ToString(int)
inherently does culture invariant conversion?
It does. The documentation isn't as clear as it might be, but it doesn't use any grouping separators, negative numbers are always prefixed with '-'
, and ASCII digits are always used.