|
StripControlChars - Delete control characters in a string
|
Total Hit (4412) |
«Code LangId=2»
' Strip all control characters (ASCII code < 32)
'
' If the second argument is True or omitted,
' CR-LF pairs are preserved
Function StripControlChars(ByVal source As String, Optional ByVal KeepCRLF As _
Boolean = True) As String
' we use this to build the result
....Read More |
Rating
|
|
|
|
|
|
ConcatenateStrings - Concatenating an array of strings
|
Total Hit (2799) |
«Code LangId=2»' Concatenate the input strings, and return the resulting string. The first
' input string is used as a separator.
'
' Example:
' Dim i As Integer = 4
' Dim d As Double = 34.45
' Dim s As String = "VB-2-The-Max"
' Dim ret As String = ConcatenateStrings(" ", s, "is a n
....Read More |
Rating
|
|
|
CountOccurrences - Counting the number of string occurrences
|
Total Hit (2926) |
«Code LangId=2»
' Count the number of string occurrences
Public Function CountOccurrences(ByVal source As String, ByVal search As String, _
Optional ByVal ignoreCase As Boolean = False) As Integer
Dim options As System.Text.RegularExpressions.RegexOptions
' set the search options a
....Read More |
Rating
|
|
|
DecodeBase64 - Decoding a string from base64
|
Total Hit (2961) |
«Code LangId=2»' Returns the input string decoded from base64
Private Function DecodeBase64(ByVal input As String) As String
Dim strBytes() As Byte = System.Convert.FromBase64String(input)
Return System.Text.Encoding.UTF8.GetString(strBytes)
End Function
«/Code»
....Read More |
Rating
|
|
|
EncodeBase64 - Encoding a string to base64
|
Total Hit (3193) |
«Code LangId=2»' Returns the input string encoded to base64
Private Function EncodeBase64(ByVal input As String) As String
Dim strBytes() As Byte = System.Text.Encoding.UTF8.GetBytes(input)
Return System.Convert.ToBase64String(strBytes)
End Function
«/Code»
....Read More |
Rating
|
|
|
|
ExplodeString - Add a filling char between a string's chars
|
Total Hit (2592) |
«Code LangId=2»
' "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(ByVal Source As String, Optional ByVal fillChar As Char = _
" "c) As String
....Read More |
Rating
|
|
|
|
FormatMemorySize - Format a value in bytes
|
Total Hit (2844) |
«Code LangId=2»
Enum FormatMemorySizeUnits
BestGuess
Bytes
Kilobytes
Megabytes
Gigabytes
End Enum
' convert a number of bytes into Kbytes, Megabytes, or Gigabytes
Function FormatMemorySize(ByVal value As Long, _
ByVal unit As FormatMemorySizeUnits, Optional B
....Read More |
Rating
|
|
|
FormatSize - Format a size expressed in bytes
|
Total Hit (2552) |
«Code LangId=2»
' Returns a formatted string that shows the size in Bytes, KBytes or MBytes
' according to the size
' Usage:
' Dim ProperSizeString As String = FormatSize("132100842")
' -> returns "125.98 MB"
Function FormatSize(ByVal SizeInBytes As Double) As String
If SizeInBytes
....Read More |
Rating
|
|
|
FormatValue - Format a value in a column of given width
|
Total Hit (2829) |
«Code LangId=2»
Enum FormatColumnAlignment
Left
Center
Right
End Enum
' format a value in a column of given width and with specified alignment
' using the specified pad character
Function FormatValue(ByVal value As String, ByVal width As Integer, _
ByVal alignment As F
....Read More |
Rating
|
|
|
|
|
|
|
InstrTbl - Search a string for any character in a table
|
Total Hit (3663) |
«Code LangId=2»
' If INCLUDE is True or is omitted, return the first occurrence of a character
' in a group
' or -1 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 TABL
....Read More |
Rating
|
|
|
InstrTblRev - The last occurrence of a char in a table
|
Total Hit (3456) |
«Code LangId=2»' If INCLUDE is True or is omitted, return the last occurrence of a character
' in a group
' or -1 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
|
|
|
|
|
|
|
|
ReverseString - Reversing a String
|
Total Hit (1679) |
«Code LangId=2»
' Reverse the input string, without using the StrRever function in the VB6
' compatibility assembly
Function ReverseString(ByVal source As String) As String
Dim chars() As Char = source.ToCharArray()
Array.Reverse(chars)
Return New String(chars)
End Function
«
....Read More |
Rating
|
|
|
SearchString - Searching a string in case [in]sensitive mode
|
Total Hit (2359) |
«Code LangId=2»
' Search the specified string, with the case-sensitive mode or not
' Returns the index of the first occurrence found, or -1 if not found
Public Function SearchString(ByVal source As String, ByVal search As String, _
Optional ByVal ignoreCase As Boolean = False) As Integer
....Read More |
Rating
|
|
|
|
|