Results 1 to 6 of 6

Thread: MID function

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2002
    Location
    here
    Posts
    16

    MID function

    What is the MID function?

  2. #2
    Addicted Member HairyDave's Avatar
    Join Date
    Aug 2002
    Location
    Er...I can't remember.
    Posts
    196
    I don't mean to be evasive or unhelpful - but have a look at msdn's docs for MID. If you still have trouble then I'm sure we'd be pleased to help.

    HD

  3. #3
    Frenzied Member vbgladiator's Avatar
    Join Date
    May 2001
    Posts
    1,950
    Mid allows you to take a portion of a string starting at certain position for specified length.

  4. #4
    Frenzied Member swatty's Avatar
    Join Date
    Aug 2002
    Location
    somewhere on earth
    Posts
    1,478
    Maybe you can do a search on MID


    I would answer , but try to use the forum to the max.
    Code:
    If Question = Incomplete Then
       AnswerNextOne
    Else
       ReplyIfKnown
    End If
    cu Swatty

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Sep 2002
    Location
    here
    Posts
    16
    Sorry about that... I have a project for a class to create a robot game using the MID function, and a friend of mine asked about it on here, and everyone kept telling her not to use MID because there were better ways to do it. It's part of the assignment. *fustration*. I probably should have asked in that string. Sorry.

  6. #6
    Frenzied Member swatty's Avatar
    Join Date
    Aug 2002
    Location
    somewhere on earth
    Posts
    1,478
    This you can do with the Mid function
    VB Code:
    1. ' you can use the mid function to change a existing string
    2.     Dim MyString
    3.     MyString = "The dog jumps"   ' Initialize string.
    4.     Mid(MyString, 5, 3) = "fox"   ' MyString = "The fox jumps".
    5.     Mid(MyString, 5) = "cow"   ' MyString = "The cow jumps".
    6.     Mid(MyString, 5) = "cow jumped over"   ' MyString = "The cow jumpe".
    7.     Mid(MyString, 5, 3) = "duck"   ' MyString = "The duc jumpe".
    8.  
    9.     ' or to substract something out of a string
    10.     MyString = "The dog jumps"   ' Initialize string.
    11.     MsgBox "Who " & Mid$(MyString, 9) & " " & Mid$(MyString, 1, 8) & "?"

    Place the code in a event and check on the value of MyString
    Code:
    If Question = Incomplete Then
       AnswerNextOne
    Else
       ReplyIfKnown
    End If
    cu Swatty

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