R
rocio
How can I format a string like this: 12924.999999999999
to print 12,925 ?
to print 12,925 ?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
rocio said:How can I format a string like this: 12924.999999999999
to print 12,925 ?
How can I format a string like this: 12924.999999999999
to print 12,925 ?
BeGomes said:Convert your string to a double, and then convert it back
to a string.
I use the following code to convert doubles to string:
Dim value as double
Dim result As String
Dim nfi As NumberFormatInfo
nfi = New CultureInfo("en-US", False).NumberFormat
nfi.NumberDecimalSeparator = "." 'set the decimal sep.
nfi.NumberGroupSeparator = "," 'set de grup sep.
nfi.NumberDecimalDigits = "0" 'set the number of decim.
result = value.ToString("N", nfi)
Try it out!
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.