Results 1 to 4 of 4

Thread: Trim - numbers

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2003
    Posts
    55

    Trim - numbers

    hey,

    sorry again newb lol .. n e ways can some one help me with a trim code to trim the first four numbers of a ten digit number for eg

    1234567890

    and i want 1234

    how would i get around this?

    i think its a trim code not sure though,

    thank you

  2. #2
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Dublin (Ireland)
    Posts
    304
    dim mystring as string = Mid(cstr(Mynumbers),1,4)

    back to integer

    dim mynewnumbers as integer = cint(mystring)

  3. #3
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    try to avoid using Mid etc... , vb.net has some great in-built functions for those jobs.
    VB Code:
    1. Dim numb As Integer = Integer.Parse("1234567890".Substring(0, 4))
    2.         MessageBox.Show(numb)
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  4. #4

    Thread Starter
    Member
    Join Date
    Dec 2003
    Posts
    55
    cheers they both worked your all geniouses on here


    if u can also solve this mystery
    http://www.vbforums.com/showthread.p...hreadid=272170

    thanks a bunch ur all genioues

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width