Results 1 to 5 of 5

Thread: Mid Function (Well i think it's a function) question

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 1999
    Location
    Vilnius, Lithuania
    Posts
    50

    Post

    Hiuston i have a problem

    I tried to make something with mid or mid$ functions but i failed.

    My problem is that i have string "12.30.98" in my program and i need to get "30" from it with MID function (it's function right?)

    Thanx

    -Casparas

  2. #2
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    Well, the first thing you need to be sure of is that the date is ALWAYS in that format (MM.DD.YY). Otherwise this will not work. But as long as it's in that format then just do this:

    Code:
    Text1.Text = Mid(Text1.Text, 4, 2)
    The way it works is like this. The first part of the Mid function is the string that you want to work with. The second part is the starting point. And the third part is the length.

    ------------------
    Ryan

  3. #3
    Junior Member
    Join Date
    Dec 1999
    Posts
    22

    Post

    To get the "30" out of "12.30.98" you would do this:

    Mydata="12.30.98"
    MyString = Mid(Mydata, 3, 2)

    Mid has three parameters. The string you want to parse, the start, and how the length. You start at 3 because you don't want "12." including in the result, and you move for two, to get 30.

    -B4

  4. #4
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    You would actually start at 4, not 3, because the "3" in 30, is the 4th letter of the string. The third letter of the string is the "."

    ------------------
    Ryan

  5. #5

    Thread Starter
    Member
    Join Date
    Dec 1999
    Location
    Vilnius, Lithuania
    Posts
    50

    Post

    Reallly big thanx (At last my program works)

    -Casparas

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