Re: FindFirstFile and underscore

From: Donald Lessau (don.snip_at_xbeat.snip.net)
Date: 08/10/04


Date: Tue, 10 Aug 2004 19:43:05 +0200


"Ulrich Korndoerfer" <ulrich_wants_nospam@prosource.de> :
> > rather than test for the ASC code for the dot.
>
> BTW, this is slower (if used with VB strings) than doing a simple
> comparison using the equal operator ;-).

Sure? IsDot03 is clearly the fastest on all inputs:

Public Function IsDot01(sFile As String) As Boolean
  IsDot01 = InStr("..", sFile) > 0
End Function
Public Function IsDot02(sFile As String) As Boolean
  IsDot02 = Asc(sFile) = vbDot
End Function
Public Function IsDot03(sFile As String) As Boolean
  IsDot03 = AscW(sFile) = vbDot
End Function
Public Function IsDot04(sFile As String) As Boolean
  IsDot04 = (sFile = ".") Or (sFile = "..")
End Function
Public Function IsDot05(sFile As String) As Boolean
  If LenB(sFile) < 6 Then
    IsDot05 = (sFile = ".") Or (sFile = "..")
  End If
End Function

Donald



Relevant Pages

  • Re: Incorporating optional function argument
    ... If, for instance, you had MsgBox =Test or Debug.Print Test there would be something for the user to observe. ... Public Function test(strMsg As String, Optional blnVal As Boolean = False) ... A break point at the Public Function line does not result in the code breaking. ...
    (microsoft.public.access.formscoding)
  • Re: Incorporating optional function argument
    ... Public Function test(strMsg As String, Optional blnVal As Boolean = False) ... If I put this into the event property, ...
    (microsoft.public.access.formscoding)
  • Re: Command button to open form and find record
    ... Opens the form if it is not already open. ... Public Function OpenFormTo(strForm As String, strWhere As String, Optional bGotoNewRecord As Boolean, _ ... Optional strOpenArgs As String) As Boolean ... Public Function HasProperty ...
    (microsoft.public.access.forms)
  • Re: Incorporating optional function argument
    ... For now I have added the optional argument to the event property function calls. ... Public Function test(strMsg As String, Optional blnVal As Boolean = False) ...
    (microsoft.public.access.formscoding)
  • Re: How to tell if a form is open?
    ... > Public Function FrmIsLoaded(frm As String) As Boolean ... > Set prj = Application.CurrentProject ...
    (comp.databases.ms-access)