|
InstrWordEx - Find a whole word, with your choice of delimiters
|
Total Hit (1708) |
«Code LangId=1»
'------------------------------------------------------------------------
' This enum is used by both InstrWordEx and ReplaceWordEx
'
' It uses a binary value to determine what separator characters are allowed
' bit 0 = allow spaces
' bit 1 = allow symbols
' bit 2 = allow cont
....Read More |
Rating
|
|
|
|
RotateLeftI - Rotate an Integer to the left
|
Total Hit (1771) |
«Code LangId=1»' Rotate an Integer to the left the specified number of times
'
' NOTE: requires Power2()
Function RotateLeftI(ByVal value As Integer, ByVal times As Long) As Integer
Dim i As Long, signBits As Integer
' no need to rotate more times than required
times = time
....Read More |
Rating
|
|
|
RotateRight - Rotate a Long to the right
|
Total Hit (1791) |
«Code LangId=1»' Rotate a Long to the right the specified number of times
'
' NOTE: requires Power2()
Function RotateRight(ByVal value As Long, ByVal times As Long) As Long
Dim i As Long, signBits As Long
' no need to rotate more times than required
times = times Mod 32
....Read More |
Rating
|
|
|
RotateRightI - Rotate an Integer to the right
|
Total Hit (1562) |
«Code LangId=1»' Rotate an Integer to the right the specified number of times
'
' NOTE: requires Power2()
Function RotateRightI(ByVal value As Integer, ByVal times As Long) As Integer
Dim i As Long, signBits As Integer
' no need to rotate more times than required
times = ti
....Read More |
Rating
|
|
|
ShiftLeft - Shift a Long to the left
|
Total Hit (1545) |
«Code LangId=1»' Shift to the left of the specified number of times
'
' NOTE: requires Power2()
Function ShiftLeft(ByVal value As Long, ByVal times As Long) As Long
' we need to create a mask of 1's corresponding to the
' times in VALUE that will be retained in the result
Dim mas
....Read More |
Rating
|
|
|
ShiftRight - Shift a Long to the right
|
Total Hit (2435) |
«Code LangId=1»' Shift to the right of the specified number of times
'
' NOTE: requires Power2()
Function ShiftRight(ByVal value As Long, ByVal times As Long) As Long
' we need to create a mask of 1's corresponding to the
' digits in VALUE that will be retained in the result
Dim
....Read More |
Rating
|
|
|
|
|
CheckUSState - Validate a US state initial
|
Total Hit (2621) |
«Code LangId=1»Public Function CheckUSState(ByVal State As String) As Boolean
If Len(State) = 2 And InStr(",AL,AK,AZ,AR,CA,CO,CT,DE,DC,FL,GA,HI,ID,IL,IN,I" _
& "A,KS,KY,LA,ME,MD,MA,MI,MN,MS,MO,MT,NE,NV,NH,NJ,NM,NY,NC,ND,OH,OK,OR,P" _
& "A,RI,SC,SD,TN,TX,UT,VT,VA,WA,WV,WI,WY,",
....Read More |
Rating
|
|
|
ConvertCamelCase - Convert from a string in camel case
|
Total Hit (3364) |
«Code LangId=1»' change a sentence in CamelCase to a sentence with spaces
' for example ConvertCamelCase("FileExchange") => "File Exchange"
Public Function ConvertCamelCase(ByVal Value As String) As String
Dim i As Long
For i = 1 To Len(Trim$(Value))
' If the character is up
....Read More |
Rating
|
|
|
|
EncryptString - Encode and decode a string
|
Total Hit (3168) |
«Code LangId=1»
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (dest As _
Any, source As Any, ByVal bytes As Long)
' encrypt a string using a password
'
' you must reapply the same function (and same password) on
' the encrypted string to obtain the original, non-enc
....Read More |
Rating
|
|
|
ExplodeString - Add a filling char between a string's chars
|
Total Hit (2832) |
«Code LangId=1»' "Explode" a string by inserting a given filling character
' between consecutive characters in the original string
'
' The source string cannot contain Chr$(0) characters
Function ExplodeString(Source As String, Optional fillChar As String = " ") As _
String
ExplodeSt
....Read More |
Rating
|
|
|
FilterString - Remove invalid characters from a string
|
Total Hit (3147) |
«Code LangId=1»' Filter out all invalid characters in a string.
Function FilterString(text As String, ValidChars As String) As String
Dim i As Long, result As String
For i = 1 To Len(text)
If InStr(ValidChars, Mid$(text, i, 1)) Then
result = result & Mid$(text, i,
....Read More |
Rating
|
|
|
FormatCreditCard - Format a credit card number
|
Total Hit (4034) |
«Code LangId=1»' Format a credit card number
Function FormatCreditCard(ByVal text As String) As String
Dim i As Long
' ignore empty strings
If Len(text) = 0 Then Exit Function
' get rid of dashes, spaces and invalid chars
For i = Len(text) To 1 Step -1
....Read More |
Rating
|
|
|
|
FormatPhoneNumber - Format a phone number
|
Total Hit (3012) |
«Code LangId=1»' Modify a phone-number to the format "XXX-XXXX" or "(XXX) XXX-XXXX".
Function FormatPhoneNumber(ByVal text As String) As String
Dim i As Long
' ignore empty strings
If Len(text) = 0 Then Exit Function
' get rid of dashes and invalid chars
For i
....Read More |
Rating
|
|
|
|
GetStringBetweenTags - Returns a string between 2 delimiters
|
Total Hit (3019) |
«Code LangId=1»' Returns a string between 2 delimiters
' Parameters:
' sSearchIn: String to search
' sFrom: First keyword
' sUntil: Second keywords
' nPosAfter: Gets the position after
'
' Example:
' Debug.Print GetStringBetweenTags("<html>This is a sample of title</html>",
'
....Read More |
Rating
|
|
|
|
|
InstrLast - Find the last occurrence of a substring
|
Total Hit (2777) |
«Code LangId=1»
' returns the last occurrence of a substring
' The syntax is similar to InStr
Function InstrLast(ByVal Start As Long, Source As String, search As String, _
Optional CompareMethod As VbCompareMethod = vbBinaryCompare) As Long
Do
' search the next occurrence
....Read More |
Rating
|
|
|
InStrRev - A replacement for VB6's InStrRev under VB4 and VB5
|
Total Hit (1873) |
«Code LangId=1»' A replacement for the InStrRev function under VB4 and VB5
'
' NOTE: uses the StrReverse function
Function InStrRev(ByVal Text As String, Search As String, _
Optional ByVal Start As Long = -1, Optional ByVal CompareMethod As _
VbCompareMethod = vbBinaryCompare) As Long
....Read More |
Rating
|
|
|
InstrRev - Backward Instr for VB4 and VB5
|
Total Hit (1712) |
«Code LangId=1»' A clone of VB6's InstrRev function (including its quirks)
' that works under VB4 and VB5
Function InstrRev(StringCheck As String, StringMatch As String, _
Optional Start As Long = -1, Optional Compare As VbCompareMethod = _
vbBinaryCompare) As Long
Dim index As
....Read More |
Rating
|
|
|
InstrTbl - Search a string for any character in a table
|
Total Hit (1648) |
«Code LangId=1»
' If INCLUDE is True or is omitted, return the first occurrence of a character
' in a group
' or zero if SOURCE doesn't contain any character among those listed in TABLE.
' If INCLUDE is False, return the first occurrence of the character in SOURCE
' that does not appear in TAB
....Read More |
Rating
|
|
|
InstrTblRev - The last occurrence of a char in a table
|
Total Hit (1823) |
«Code LangId=1»' If INCLUDE is True or is omitted, return the last occurrence of a character
' in a group
' or zero if SOURCE doesn't contain any character among those listed in TABLE.
' If INCLUDE is False, return the last occurrence of the character in SOURCE
' that does not appear in TABLE.
....Read More |
Rating
|
|
|
InstrWord - Search a whole word
|
Total Hit (1557) |
«Code LangId=1»' Return the next occurrence of a whole word
Function InstrWord(start, Text, search, compareMethod) As Long
Dim index As Long
Dim charcode As Integer
' assume the search fails
InstrWord = 0
index = start - 1
Do
' search the next
....Read More |
Rating
|
|
|
Rnd2 - A random value in a range
|
Total Hit (1518) |
«Code LangId=1»
' A random number in the range (low, high)
Function Rnd2(low As Single, high As Single) As Single
Rnd2 = Rnd * (high - low) + low
End Function
«/Code»
|
Rating
|
|
|
RotateLeft - Rotate a Long to the left
|
Total Hit (1739) |
«Code LangId=1»' Rotate a Long to the left the specified number of times
'
' NOTE: requires Power2()
Function RotateLeft(ByVal value As Long, ByVal times As Long) As Long
Dim i As Long, signBits As Long
' no need to rotate more times than required
times = times Mod 32
....Read More |
Rating
|
|