Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

VB6 find string at a given index

  • 28-06-2006 2:28pm
    #1
    Registered Users, Registered Users 2 Posts: 4,114 ✭✭✭


    Is there a method in VB6 that will find a substring of a string given it's position in the string?
    I know how to do it in VB.NET (below)


    Dim StrText1 as String = ""
    Dim StrText2 as String = ""
    StrText1 ="Hello"
    StrText2 = (strText1.Chars(1))

    The above code would return "ello" to the variable StrText2.


Comments

  • Closed Accounts Posts: 80 ✭✭Torak


    Right()


  • Registered Users, Registered Users 2 Posts: 4,114 ✭✭✭lukin


    Thanks Torak


  • Registered Users, Registered Users 2 Posts: 1,456 ✭✭✭FSL


    Right(string, length) just gives the number of characters from the right specified by length. Mid(string, start[, length]) returns then number of characters specified by length, from string, starting at start. If length is not specified or is greater than the number of characters from start to the end of then it returns all the charaters from start to the end.


  • Closed Accounts Posts: 2,268 ✭✭✭mountainyman


    To return the substring use
    Left$
    Right$

    dim strFilename as String
    Dim strLastSlash as String
    dim strDirectory as String

    strLastSlash = InStrRev(strFilename, "\")
    strDirectory = Left$(strFilename, strLastSlash)

    MM


Advertisement