|
InstrWordEx - Find a whole word, with your choice of delimiters
|
Total Hit (1754) |
«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 (2063) |
«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
|
|
|
|
|
Bin - Convert from decimal to binary
|
Total Hit (3837) |
«Code LangId=2»' convert from decimal to binary
' if you pass the Digits argument, the result is truncated to that number of
' digits
'
' you should always specify Digits if passing negative values
Function Bin(ByVal value As Long, Optional ByVal digits As Short = -1) As String
' conver
....Read More |
Rating
|
|
|
BinToDec - Convert from binary to decimal
|
Total Hit (3771) |
«Code LangId=2»' convert from binary to decimal
Function BinToDec(ByVal value As String) As Long
' we just need a call to the Convert.ToInt64 static method
Return Convert.ToInt64(value, 2)
End Function
«/Code»
|
Rating
|
|
|
Dec2Any - Convert a decimal number to any other base
|
Total Hit (4074) |
«Code LangId=2»' convert a positive number to any base
' BASE can be in the range 2-36
Function Dec2Any(ByVal number As Long, ByVal base As Short) As String
Dim index As Integer
Dim digitValue As Integer
Dim res As New System.Text.StringBuilder()
Const digits As String = "0
....Read More |
Rating
|
|
|
EvaluateModule - a module for evaluating expressions
|
Total Hit (2673) |
«Code LangId=2»' A module for evaluating expressions, with support for
' parenthesis and many math functions
' Example:
' Dim expr As String = "(SQR(9)^3)+COS(0)*3+ABS(-10)"
' txtResult.Text = Evaluate(expr).ToString ' ==> 27+3+10 ==> 40
Imports System.Text.RegularExpressions
M
....Read More |
Rating
|
|
|
Hex - Convert from decimal to hexadecimal
|
Total Hit (3994) |
«Code LangId=2»' convert from decimal to hexadecimal
' if you pass the Digits argument, the result is truncated to that number of
' digits
'
' you should always specify Digits if passing negative values
Function Hex(ByVal value As Long, Optional ByVal digits As Short = -1) As String
' c
....Read More |
Rating
|
|
|
Hex2Dec - Convert from hexadecimal to decimal
|
Total Hit (8379) |
«Code LangId=2»' convert from hexadecimal to decimal
Function HexToDec(ByVal value As String) As Long
' we just need a call to the Convert.ToInt64 static method
Return Convert.ToInt64(value, 16)
End Function
«/Code»
|
Rating
|
|
|
CheckUSState - Validate a US state initial
|
Total Hit (2718) |
«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 (3451) |
«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 (3248) |
«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 (2922) |
«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 (3224) |
«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 (4129) |
«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 (3138) |
«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 (3094) |
«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 (2903) |
«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 (1974) |
«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 (1809) |
«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 (1687) |
«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 (1874) |
«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 (1612) |
«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
|
|