|
InStrRev - A replacement for VB6's InStrRev under VB4 and VB5
|
Total Hit (1872) |
«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 (1711) |
«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 (1645) |
«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 (1822) |
«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 (1555) |
«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
|
|
|
InstrWordEx - Find a whole word, with your choice of delimiters
|
Total Hit (1707) |
«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
|
|
|
|
IsNullString - Check whether a string contains white-spaces
|
Total Hit (1963) |
«Code LangId=1»
' Return True is a string is made only of spaces, tabs, and Null characters.
' This function is especially useful to test whether fixed-length strings
' are initialized.
Function IsNullString(Text As String) As Boolean
Dim i As Long
For i = 1 To Len(Text)
Se
....Read More |
Rating
|
|
|
|
|
|
IsValidPhoneField - Check whether a phone number is valid
|
Total Hit (1671) |
«Code LangId=1»' Validate attributes of Phone data
' Returns True if valid, False if invalid
'
' Also returns the phone in formatted fashion (USA format).
' Will convert alphabetics to numeric
'
'Example:
' If IsValidPhoneField(Value:="3034414444", ReformattedPhone:=strNewPhone,
' '
....Read More |
Rating
|
|
|
|
|
JoinQuoted - A Join variant that encloses string values in quotes
|
Total Hit (1606) |
«Code LangId=1»' Join variant that works with arrays of any type
' and that encloses string values between quotes
'
' ARR is the array whose element must be joined
' SEPARATOR is the separator char (default is comma)
' QUOTED is the character used to quote string values
' use a two-char st
....Read More |
Rating
|
|
|
NumberToWords - Convert a number into its string representation
|
Total Hit (1852) |
«Code LangId=1»
' Convert a number into its textual equivalent.
'
' Pass True in the second argument if you want a null string when
' zero is passed.
' This is a recursive routine that is probably the most concise
' routines that solves the problem
Function NumberToWords(ByVal Number As L
....Read More |
Rating
|
|
|
|
|
PrintF - Transforming template strings
|
Total Hit (1750) |
«Code LangId=1»' This VB6 function returns a string with a set of parameters replaced with
' variables, similar to the C function printf().
Public Function PrintF(strMask As String, ParamArray Values()) As String
On Error Resume Next
' pass in a mask with variables in the order of \0
....Read More |
Rating
|
|
|
RandomString - Generate a random string using a mask
|
Total Hit (2305) |
«Code LangId=1»' generate a random string
'
' the mask can contain the following special chars
' ? : any ASCII character (1-127)
' # : a digit
' A : an alphabetic char
' N : an alphanumeric char
' H : an hex char
' all other chars are taken literally
' Example: a random-ge
....Read More |
Rating
|
|
|
ReplaceArgs - Replace numbered placeholders in a string
|
Total Hit (1585) |
«Code LangId=1»' Replace placeholders in the form @@1, @@2, etc.
' with arguments passed after the first one.
' For example, calling this function with
' res = ReplaceArgs("File @@1 not found on drive @@2", "README.TXT", "C:")
' it returns the string
' "File README.TXT not found in drive
....Read More |
Rating
|
|
|
|
ReplaceLast - Replace the last occurrence of a substring
|
Total Hit (2126) |
«Code LangId=1»' Replace the last occurrence of a string
Function ReplaceLast(Expression As String, Find As String, ReplaceStr As String, _
Optional Compare As VbCompareMethod) As String
Dim i As Long
i = InStrRev(Expression, Find, , Compare)
If i Then
' the search s
....Read More |
Rating
|
|
|
ReplaceMulti - Multiple string replacements
|
Total Hit (1856) |
«Code LangId=1»' Perform multiple substitutions in a string
' The first argument is the string to be searched
' The second argument is vbBinaryCompare or vbTextCompare
' and tells whether the search is case sensitive or not
' The following arguments are pairs of (find, replace) strings
'
....Read More |
Rating
|
|
|
ReplaceWord - Replace whole words
|
Total Hit (1722) |
«Code LangId=1»' Replace a whole word
Function ReplaceWord(Source As String, Find As String, ReplaceStr As String, _
Optional ByVal Start As Long = 1, Optional Count As Long = -1, _
Optional Compare As VbCompareMethod = vbBinaryCompare) As String
Dim findLen As Long
Dim rep
....Read More |
Rating
|
|
|
|
ReplicateString - Replicate a string a given number of times
|
Total Hit (2187) |
«Code LangId=1»' Replicate a string a given number of times
Function ReplicateString(Source As String, Times As Long) As String
Dim length As Long, index As Long
' Create the result buffer
length = Len(Source)
ReplicateString = Space$(length * Times)
' do the multiple co
....Read More |
Rating
|
|
|
|
Soundex - Determine the phonetic code of a word
|
Total Hit (1900) |
«Code LangId=1»
' The Soundex code of an alphabetical string
'
' you can use Soundex code for phonetic searches
' Beware: this isn't bullet-proof!
'
' UPDATE: this version corrects a bug in the original routine
' thanks to Edward Wittke for spotting the mistake
Function Soundex(By
....Read More |
Rating
|
|
|
Split - A replacement for VB6's Split function under VB5
|
Total Hit (1828) |
«Code LangId=1»
' A replacement for the Split function under VB4 and VB5
'
' Note that the return value is a Variant that contains
' an array of strings
Function Split(ByVal Text As String, Optional ByVal Delimiter As String = " ", _
Optional ByVal Limit As Long = -1, Optional CompareMe
....Read More |
Rating
|
|