splitting a double

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hello prof.

What is the best way to split a double so that I can count the value before
the comma and after the comma?

example

123,1234

intbefore = total(before) '123
intafter = total(after) '1234
 
Dim
s()=mydouble.tostring(System.Globalization.CultureInfo.invariantculture).split(".")
If s.lenght>0 then
intafter=s(1).lenght
intbefore=s(0).lenght
else
intafter=0
intbefore=s(0).lenght
end if
 
Mat,

Very nice, however why not after that nice split that you do where you keep
track of the cultures, this simple one?

\\\
dim s() as string = _
(123.1234).tostring(System.Globalization.CultureInfo.invariantculture).split(".")
Dim a1 As Integer = CInt(s(0))
Dim a2 As Integer = CInt(s(1))
////

Cor
 

Ask a Question

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.

Ask a Question

Back
Top