Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2002

    Unanswered: Find a character in a string

    I have a field called ID which consists of 2 "/". For
    example, AAA/2002/1. What I wanna do is find where the
    first "/" and second "/" located. So in this example, it
    should return 4 and 9. What I wanna do is to separate
    those 3 values: AAA, 2002 and 1. However, the length of
    each is not constant. It could be BB/02/20.

    This can be easily accomplished in excel using Find and

    Any suggestion ? Thanks.

  2. #2
    Join Date
    Apr 2002
    You can use the instr function.
    InStr([Start, ]String1, String2[, Compare])

    it searches in String1 for the appearance of String2 returning the position. Start defines the character to begin with (1 based). In your case you'd call the function twice:

    dim pos1 as integer
    dim pos2 as integer

    pos1 = InStr(1, MyString, "/")
    pos2 = InStr(pos1+1, MyString, "/")

Posting Permissions

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