splitting a double

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • steve

    #1

    splitting a double

    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
  • Mat

    #2
    Re: splitting a double

    Dim
    s()=mydouble.to string(System.G lobalization.Cu ltureInfo.invar iantculture).sp lit(".")
    If s.lenght>0 then
    intafter=s(1).l enght
    intbefore=s(0). lenght
    else
    intafter=0
    intbefore=s(0). lenght
    end if

    "steve" <steve@discussi ons.microsoft.c om> wrote in message
    news:EDDF71D4-F076-4111-8A06-33714C7FA6AE@mi crosoft.com...[color=blue]
    > 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[/color]


    Comment

    • Cor Ligthert [MVP]

      #3
      Re: splitting a double

      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).tost ring(System.Glo balization.Cult ureInfo.invaria ntculture).spli t(".")
      Dim a1 As Integer = CInt(s(0))
      Dim a2 As Integer = CInt(s(1))
      ////

      Cor


      Comment

      Working...