|
Visual Basic (VB and VBA) |
|
Copyright 1999-2001 Christopher Greaves. All rights reserved. Home Page and email to [email protected] |
| If in doubt, record a macro and inspect the entrails! |
Please read the DISCLAIMER.
Here is an INDEX to all the procedures.
You will probably need one copy of my GLOBAL DECLARATIONS.
Public Function strAllBut(strIn As String, i As Integer) As String
' Procedure : strAllBut
' Description: returns all but a specific character of a string.
' Copyright: Chris Greaves Inc.
' Inputs: string, integer position.
' Returns: all the string, or one element missing.
' Assumes: None.
' Side Effects: None.
' Tested: By the tests shown below.
If i > 0 Then
strAllBut = Left$(strIn, i - 1)
Else
strAllBut = ""
End If
If i > Len(strIn) Then
Else
strAllBut = strAllBut & Right$(strIn, Len(strIn) - i)
End If
'Sub TESTstrAllBut()
'MsgBox strAllBut("abc", 0) ' illegal position, return the entire string
'MsgBox strAllBut("abc", 1) ' drop the 1st character
'MsgBox strAllBut("abc", 2) ' drop the 2nd character
'MsgBox strAllBut("abc", 3) ' drop the 3rd character
'MsgBox strAllBut("abc", 4) ' illegal position, return the entire string
'End Sub
End Function
| We all knew nothing when we started … |
|
Home Page and Contact Information Send email to [email protected]. This page was last updated Thursday, November 15, 2001 |