Results 1 to 4 of 4

Thread: [RESOLVED] workign with 5 digit number

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Posts
    507

    Resolved [RESOLVED] workign with 5 digit number

    hi guys

    I have a 5 digit number as a string. Here is an example.

    12345

    I want to get rid of number 3., its always 5 characters I need to get rid of the middle number which is the third character. in this example is 3.

    What is the best way.

    Thanks

  2. #2
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: workign with 5 digit number

    Should work
    Code:
    String = String.SubString(0,2) & String.SubString(3,2)
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  3. #3
    Hyperactive Member The Fire Snake's Avatar
    Join Date
    Sep 2009
    Location
    USA
    Posts
    401

    Re: workign with 5 digit number

    Since the 5 digit number is represented as a string you can make use of the great methods in the String class. The method to look at is Remove. So here is an example:

    vb Code:
    1. Dim Your5DigitNumber as String = "12345"
    2.  
    3. Your5DigitNumber = Your5DigitNumber.Remove(2,1)

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Posts
    507

    Re: workign with 5 digit number

    Thank you , that worksded

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