Results 1 to 5 of 5

Thread: Easy question, just can not remember!!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    85

    Question

    I want to compare two strings letter by letter. Why it is to find the filename to get the path. How do I do this??
    Using VB6 Still Pluging away

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946
    Code:
    Option Explict
    Option Compare Text
    
    'event code
    
    'StrComp function returns a number...0 if matched, 1 if false
    'compare strings to see if you have a matching string or not
    '
    	strMyCompare = StrComp(string1, String2, 1) 'comparison function
         
    	If StrMyComp = 0 then           
         		'do bla bla bla because one = two
         		'do bla bla bla
    	
    'or...	if false then
    	
    	Else
    		'do bla bla bla  because one <> Two
    	End If
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    85
    Will this return true if only part of the string matches? My problem is that I'm comparing a filename string to a path + filename string. I need to get the full path for the filename. I have a collection that stores the path + filename. I have a list box that contains the filename. I'm using the filename from the list box to compare to the path + filename in the collection. Is there away to just compare
    the last part of a string??

    Example: C:\AB Directory\TestDir\Mergedfiles.pdf

    result = compare "Mergedfiles.pdf" to _
    "C:\AB Directory\TestDir\Mergedfiles.pdf"

    the result should be yes
    Using VB6 Still Pluging away

  4. #4
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    Code:
    If strFileName = Right$(strPath, Len(strFileName)) Then
      'Bingo!
    End If
    Iain, thats with an i by the way!

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    85
    Thanks!!!
    Using VB6 Still Pluging away

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