Add comma to an integer value

HI,

Value is 12344
And I want to add comma after before 4 so it should be like 1234,4

I tried with this… but not working
If(Str_var.ToString.Contains(""),Split(Str_var.ToString.Length,(-1,1)),+","+Split(Str_var.ToString,"")(1))

How can i do that?

If MyStr = “12344” and is a String value, then you can set it by assigning MyStr to MyStr.Substring(0, MyStr.Length - 2) + "," + MyStr.Substring(MyStr.Length - 2, 1).

If MyInt = 12344 and is an Int32 value, then set MyStr to MyInt.ToString.Substring(0, MyInt.ToString.Length - 2) + "," + MyInt.ToString.Substring(MyInt.ToString.Length - 2, 1).

1 Like

the string value is unknown and it can by any value :frowning: so i need to check length

can you tell us your actual requirement… are you trying to show values with comma separated like money pattern?
13001223 = 13,001,223

or something else?

its a scrap value…
sometime scrap have issue with rading the value and it can not read Comma.
like if scap value is… 134,1 its readin 1341 and same if value is 12375,5 then it will read like 123755.
it always when the value have one digit after comma it can not read…

1 Like

@Latif
with the information that it is a scrap value so we assumen that it is available as string
I do agree to @Anthony_Humphries inputs, but also do have a notice on these alternates:

  • grafik
  • taking control over NumberFormatInfo and its configuration
1 Like

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