Class Globals
- Namespace
- PolarStudioGlobals
- Assembly
- PolarStudioGlobals.dll
public static class Globals
- Inheritance
-
Globals
- Inherited Members
Fields
BinaryCompare
Compare binary based (case sensitive).
public const int BinaryCompare = 0
Field Value
GetPerformanceCounterFrequency
public const long GetPerformanceCounterFrequency = 10000000
Field Value
NullDate
The default value for a VB-date.
public static DateTime NullDate
Field Value
TextCompare
Compare text based (not case sensitive).
public const int TextCompare = 1
Field Value
mcHexCharacters
Characters allowed in hex strings.
public const string mcHexCharacters = "0123456789abcdefABCDEF"
Field Value
mcKeywordContinueCharacters
Characters allowed in keywords.
public const string mcKeywordContinueCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"
Field Value
mcKeywordStartCharacters
Characters that a keyword can start with.
public const string mcKeywordStartCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_"
Field Value
mcNumberContinueCharacters
Characters allowed in numbers.
public const string mcNumberContinueCharacters = "0123456789."
Field Value
mcNumberStartCharacters
Characters a number can start with.
public const string mcNumberStartCharacters = "+-0123456789."
Field Value
vbCr
Constant for carriage return (chr 13)
public const string vbCr = "\r"
Field Value
vbCrLf
Constant for carriage return/line feed (chr 13, chr 10)
public const string vbCrLf = "\r\n"
Field Value
vbLf
Constant for carriage line feed (chr 10)
public const string vbLf = "\n"
Field Value
vbNullChar
Constant for Null-character (chr 0)
public const char vbNullChar = '\0'
Field Value
vbTab
Constant for tab. (chr 9)
public const string vbTab = "\t"
Field Value
Properties
GetPerformanceCounter
public static long GetPerformanceCounter { get; }
Property Value
Time
public static DateTime Time { get; }
Property Value
Methods
AddNumberToDate(DateTime, double)
public static DateTime AddNumberToDate(DateTime pDate, double pNumber)
Parameters
Returns
Array(params object[])
public static object[] Array(params object[] pElements)
Parameters
pElements
object[]
Returns
- object[]
Array<T>(params T[])
public static T[] Array<T>(params T[] pElements)
Parameters
pElements
T[]
Returns
- T[]
Type Parameters
T
Asc(string)
public static int Asc(string pString)
Parameters
pString
string
Returns
AssemblyPath()
public static string AssemblyPath()
Returns
Base32Decode(string)
public static string Base32Decode(string pBase32encodedString)
Parameters
pBase32encodedString
string
Returns
Base32Encode(string)
public static string Base32Encode(string pUnicodeString)
Parameters
pUnicodeString
string
Returns
Base64Decode(string)
public static string Base64Decode(string pBase64encodedString)
Parameters
pBase64encodedString
string
Returns
Base64DecodeToBytes(string)
public static byte[] Base64DecodeToBytes(string pBase64encodedString)
Parameters
pBase64encodedString
string
Returns
- byte[]
Base64Encode(byte[])
public static string Base64Encode(byte[] pByteArray)
Parameters
pByteArray
byte[]
Returns
Base64Encode(string)
public static string Base64Encode(string pUnicodeString)
Parameters
pUnicodeString
string
Returns
BringInRange<T>(T, T, T)
Brings a value within the range defined by the pMinValue and pMaxValue.
public static T BringInRange<T>(T pValue, T pMinValue, T pMaxValue) where T : IComparable
Parameters
pValue
TThe Source value
pMinValue
TThe minimum allowed value.
pMaxValue
TThe maximum allowed value
Returns
- T
A value that is within the specified range.
Type Parameters
T
The type. Must be IComparable
ByteArrayToHex(byte[])
public static string ByteArrayToHex(byte[] hash)
Parameters
hash
byte[]
Returns
ByteArrayToString(byte[])
public static string ByteArrayToString(byte[] pByteArray)
Parameters
pByteArray
byte[]
Returns
CBool(object)
public static bool CBool(object pValue)
Parameters
pValue
object
Returns
Chr(int)
public static string Chr(int pCharNumber)
Parameters
pCharNumber
int
Returns
CleanupString(string, string)
public static string CleanupString(string pInputString, string pAcceptedCharacters = "")
Parameters
Returns
ComposeString(string, int)
public static string ComposeString(string pCharacter, int pCharacterCount)
Parameters
Returns
CreateDottedString(string)
public static string CreateDottedString(string pInputString)
Parameters
pInputString
string
Returns
CreateException(int, string, string)
public static Exception CreateException(int pErrorNumber, string pSource, string pMessage)
Parameters
Returns
CreateGUID(bool)
Creates a GUID string.
public static string CreateGUID(bool pRemoveDashes = true)
Parameters
pRemoveDashes
boolIf True, the dashes are removed.
Returns
- string
A string with a GUID.
CreateMD5hash(string)
public static string CreateMD5hash(string pMessage)
Parameters
pMessage
string
Returns
CreateMutex(string)
public static Mutex CreateMutex(string pName)
Parameters
pName
string
Returns
CreateObject(string)
public static object CreateObject(string pClassName)
Parameters
pClassName
string
Returns
CreatePath(string)
Creates the path in the file system.
public static bool CreatePath(string pPath)
Parameters
pPath
stringThe path to create.
Returns
- bool
A boolean indicating success. Also returns True if the path already existed.
DateAdd(string, int, DateTime)
public static DateTime DateAdd(string pInterval, int pNumber, DateTime pDate)
Parameters
Returns
DateSerial(int, int, int, int, int, int)
public static DateTime DateSerial(int pYear, int pMonth, int pDay, int pHour = 0, int pMinute = 0, int pSecond = 0)
Parameters
Returns
DateValue(DateTime)
Returns the date-part of the specified date/time.
public static DateTime DateValue(DateTime pInputDate)
Parameters
pInputDate
DateTime
Returns
DecimalVal(object)
Converts the specified string to a decimal number. Also accepts &H... and 0x... expressions for hex. Uses InvariantCulture (decimal dot).
public static decimal DecimalVal(object pValue)
Parameters
pValue
objectThe number to convert.
Returns
- decimal
A number.
DecimalVal(string)
Converts the specified string to a decimal number. Also accepts &H... and 0x... expressions for hex. Uses InvariantCulture (decimal dot).
public static decimal DecimalVal(string pString)
Parameters
pString
stringThe number to convert.
Returns
- decimal
A number.
DecryptRijndael(string, string, bool)
public static string DecryptRijndael(string pKey, string pBase64stringToDecrypt, bool pBinaryText = false)
Parameters
Returns
DeleteFile(string)
public static bool DeleteFile(string pPath)
Parameters
pPath
string
Returns
DynamicHasProperty(dynamic, string)
public static bool DynamicHasProperty(dynamic obj, string name)
Parameters
obj
dynamicname
string
Returns
EncryptRijndael(string, string, bool)
public static string EncryptRijndael(string pKey, string pTextToEncrypt, bool pBinaryText = false)
Parameters
Returns
EscapeStringFromXML(string)
public static string EscapeStringFromXML(string pInputString)
Parameters
pInputString
string
Returns
EscapeStringToHTML(string, bool)
public static string EscapeStringToHTML(string pInputString, bool pEscapeLineBreaks = false)
Parameters
Returns
EscapeStringToJSON(string)
public static string EscapeStringToJSON(string pInputString)
Parameters
pInputString
string
Returns
EscapeStringToJavaScript(string)
public static string EscapeStringToJavaScript(string pInputString)
Parameters
pInputString
string
Returns
EscapeStringToJavaScriptSimple(string)
public static string EscapeStringToJavaScriptSimple(string pInputString)
Parameters
pInputString
string
Returns
EscapeStringToVBScript(string, bool)
public static string EscapeStringToVBScript(string pInputString, bool pRespectLineFeeds = false)
Parameters
Returns
EscapeStringToXML(string)
public static string EscapeStringToXML(string pInputString)
Parameters
pInputString
string
Returns
EscapeVBscriptStringParameter(string)
public static string EscapeVBscriptStringParameter(string pParameterValue)
Parameters
pParameterValue
string
Returns
ExeName()
public static string ExeName()
Returns
ExePath()
public static string ExePath()
Returns
ExeVersion()
public static string ExeVersion()
Returns
ExeVersion_Coded()
public static string ExeVersion_Coded()
Returns
ExtendPath(string)
public static string ExtendPath(string pPath)
Parameters
pPath
string
Returns
FileCopy(string, string)
public static bool FileCopy(string pSourcePath, string pDestinationPath)
Parameters
Returns
FileDateTime(string)
public static DateTime FileDateTime(string pPath)
Parameters
pPath
string
Returns
FromHTTPdate(string)
public static DateTime FromHTTPdate(this string pDate)
Parameters
pDate
string
Returns
FullExeName()
public static string FullExeName()
Returns
GPPS(string, string, string)
public static string GPPS(string pFileName, string pSectionName, string pKeyName)
Parameters
Returns
GenerateRandomKey(int)
Creates a new crypto-safe random key.
public static string GenerateRandomKey(int pKeyLength = 1)
Parameters
pKeyLength
intThe key-length in 'blocks'. Values 1-16. Each block results in 16 characters hex data (64 bit key). A value of 4 can be used for 'long' keys (64 characters, 256 bits).
Returns
- string
A hex string with random bytes.
GetCharacters(ref string, int)
public static string GetCharacters(ref string pInputString, int pCharcount = 1)
Parameters
Returns
GetCommand(ref string, string, bool, bool, bool)
public static string GetCommand(ref string pInputLine, string pSepChar, bool pRecognizeSQLbrackets = false, bool pRecognizeSingleQuotes = false, bool pSearchQuote_SupportCurlyBrackets = false)
Parameters
pInputLine
stringpSepChar
stringpRecognizeSQLbrackets
boolpRecognizeSingleQuotes
boolpSearchQuote_SupportCurlyBrackets
bool
Returns
GetCommand(ref string, string, ref string, bool, bool)
public static string GetCommand(ref string pInputLine, string pSepChar, ref string pErrorMessage, bool pRecognizeSQLbrackets = false, bool pRecognizeSingleQuotes = false)
Parameters
pInputLine
stringpSepChar
stringpErrorMessage
stringpRecognizeSQLbrackets
boolpRecognizeSingleQuotes
bool
Returns
GetCommand_Reverse(ref string, string)
public static string GetCommand_Reverse(ref string pInputLine, string pSepChar)
Parameters
Returns
GetCommand_Reverse(ref string, string, ref string, ref bool, bool, bool)
public static string GetCommand_Reverse(ref string pInputLine, string pSepChar, ref string pErrorMessage, ref bool pSepCharFound, bool pRecognizeSQLbrackets = false, bool pRecognizeSingleQuotes = false)
Parameters
pInputLine
stringpSepChar
stringpErrorMessage
stringpSepCharFound
boolpRecognizeSQLbrackets
boolpRecognizeSingleQuotes
bool
Returns
GetCurrentProcessId()
public static int GetCurrentProcessId()
Returns
GetErrorMessage(Exception)
public static string GetErrorMessage(Exception pException)
Parameters
pException
Exception
Returns
GetFileExtension(string)
Gets the file extension from a (full) filename (without the dot).
public static string GetFileExtension(string pFileName)
Parameters
pFileName
stringThe full file name to get the file extension from, like: 'C:\temp\Photo.jpg'
Returns
- string
The file extension, like: 'jpg'
GetFileName(string)
Gets the filename of a full filename (removes the folder).
public static string GetFileName(string pFileName)
Parameters
pFileName
stringThe full file name to get the file name from, like: 'C:\temp\Photo.jpg'
Returns
- string
The file name, like: 'Photo.jpg'
GetFilePath(string)
Gets the path (containing folder) from a file name. Will end on a slash.
public static string GetFilePath(string pFileName)
Parameters
pFileName
stringThe name to get the path from. Like: 'C:\temp\Photo.jpg'
Returns
- string
The path for the specified name. Like: 'C:\temp'
GetFileVersion(string)
public static string GetFileVersion(string pFilePath)
Parameters
pFilePath
string
Returns
GetFreeSpace(string)
public static long GetFreeSpace(string pDisk)
Parameters
pDisk
string
Returns
GetInternetDocument(string)
public static string GetInternetDocument(string pURL)
Parameters
pURL
string
Returns
GetInternetDocument(string, ref string, string, Dictionary<string>, Dictionary<string>, int)
public static string GetInternetDocument(string pURL, ref string pErrorMessage, string pPostData, Dictionary<string> pHeaders, Dictionary<string> pReturnedHeaders, int pTimeoutMs = 0)
Parameters
pURL
stringpErrorMessage
stringpPostData
stringpHeaders
Dictionary<string>pReturnedHeaders
Dictionary<string>pTimeoutMs
int
Returns
GetInternetDocument(string, ref string, string, int)
public static string GetInternetDocument(string pURL, ref string pErrorMessage, string pPostData = "", int pTimeoutMs = 0)
Parameters
Returns
GetInternetDocument(string, ref string, string, string, ref string, ref string, int)
public static string GetInternetDocument(string pURL, ref string pErrorMessage, string pPostData, string pHeaders, ref string pReturnedHeaders, ref string pContentType_InOut, int pTimeoutMs = 0)
Parameters
pURL
stringpErrorMessage
stringpPostData
stringpHeaders
stringpReturnedHeaders
stringpContentType_InOut
stringpTimeoutMs
int
Returns
GetItemFromCollection(dynamic, object)
public static object GetItemFromCollection(dynamic pCollection, object pIndex)
Parameters
pCollection
dynamicpIndex
object
Returns
GetKeyword(ref string, bool, bool, bool, bool)
public static string GetKeyword(ref string pInputString, bool pIgnoreSpaces = true, bool pOptimizeForVBscriptParsing = false, bool pTreatPlusAndMinusAsOperators = false, bool pKeepSpacesAtRemainder = false)
Parameters
pInputString
stringpIgnoreSpaces
boolpOptimizeForVBscriptParsing
boolpTreatPlusAndMinusAsOperators
boolpKeepSpacesAtRemainder
bool
Returns
GetProcessMemory()
public static long GetProcessMemory()
Returns
GetStringPart(string, string, bool)
public static string GetStringPart(string pInputString, string pSepChar = "", bool pCompareBinary = false)
Parameters
Returns
GetStringPart(ref string, string, bool)
public static string GetStringPart(ref string pInputString, string pSepChar = "", bool pCompareBinary = false)
Parameters
Returns
GetTickCount()
public static int GetTickCount()
Returns
GetTickCount64()
public static long GetTickCount64()
Returns
GetVirtualProcessMemory()
public static long GetVirtualProcessMemory()
Returns
GetXMLnodeValue(XmlDocument, string, string)
public static string GetXMLnodeValue(XmlDocument pXMLdocument, string pNodePath, string pDefaultValue = "")
Parameters
pXMLdocument
XmlDocumentpNodePath
stringpDefaultValue
string
Returns
GetXMLnodeValue(XmlNode, string, string)
public static string GetXMLnodeValue(XmlNode pXmlNode, string pNodePath, string pDefaultValue = "")
Parameters
Returns
HMAC_SHA1(byte[], byte[])
public static byte[] HMAC_SHA1(byte[] key, byte[] message)
Parameters
Returns
- byte[]
HMAC_SHA1(string, string)
public static string HMAC_SHA1(string pKey, string pMessage)
Parameters
Returns
HMAC_SHA1_HexKey(string, string)
public static string HMAC_SHA1_HexKey(string pKeyHex, string pMessage)
Parameters
Returns
HMAC_SHA256(byte[], byte[])
public static byte[] HMAC_SHA256(byte[] key, byte[] message)
Parameters
Returns
- byte[]
HMAC_SHA256(string, string)
public static string HMAC_SHA256(string pKey, string pMessage)
Parameters
Returns
HMAC_SHA256_HexKey(string, string)
public static string HMAC_SHA256_HexKey(string pKeyHex, string pMessage)
Parameters
Returns
HMAC_SHA512(byte[], byte[])
public static byte[] HMAC_SHA512(byte[] key, byte[] message)
Parameters
Returns
- byte[]
HMAC_SHA512(string, string)
public static string HMAC_SHA512(string pKey, string pMessage)
Parameters
Returns
HMAC_SHA512_HexKey(string, string)
public static string HMAC_SHA512_HexKey(string pKeyHex, string pMessage)
Parameters
Returns
HasWritePermissionOnFolderOrFile(string)
public static bool HasWritePermissionOnFolderOrFile(string pPathToFolderOrFile)
Parameters
pPathToFolderOrFile
string
Returns
Hex(byte)
public static string Hex(byte pNumber)
Parameters
pNumber
byte
Returns
Hex(short)
public static string Hex(short pNumber)
Parameters
pNumber
short
Returns
Hex(int)
public static string Hex(int pNumber)
Parameters
pNumber
int
Returns
HexToByteArray(string)
public static byte[] HexToByteArray(string pHexData)
Parameters
pHexData
string
Returns
- byte[]
HexToNumber(string)
public static long HexToNumber(string pInputString)
Parameters
pInputString
string
Returns
HexToString(string)
public static string HexToString(string pHexString)
Parameters
pHexString
string
Returns
InStr(int, string, string, int)
public static int InStr(int pStart, string pSourceString, string pFindString, int pCompareMode = 0)
Parameters
Returns
InStr(string, string)
public static int InStr(string pSourceString, string pFindString)
Parameters
Returns
InStrRev(string, string, int, int)
public static int InStrRev(string pSourceString, string pFindString, int pStart = -1, int pCompareMode = 0)
Parameters
Returns
In<T>(T, params T[])
public static bool In<T>(this T pCheckValue, params T[] pValues) where T : IComparable
Parameters
pCheckValue
TpValues
T[]
Returns
Type Parameters
T
Int(double)
public static int Int(double pValue)
Parameters
pValue
double
Returns
IntVal(object)
Converts the specified pValue to a number and returns the integer value (using floor).
public static int IntVal(object pValue)
Parameters
pValue
objectThe value to convert.
Returns
- int
An integer value.
IsHex(string)
public static bool IsHex(string pInputString)
Parameters
pInputString
string
Returns
IsLikeInt32(decimal)
public static bool IsLikeInt32(this decimal pValue)
Parameters
pValue
decimal
Returns
IsLikeInt32(double)
public static bool IsLikeInt32(this double pValue)
Parameters
pValue
double
Returns
IsLikeInt64(decimal)
public static bool IsLikeInt64(this decimal pValue)
Parameters
pValue
decimal
Returns
IsLikeInt64(double)
public static bool IsLikeInt64(this double pValue)
Parameters
pValue
double
Returns
IsNull(object)
public static bool IsNull(object pValue)
Parameters
pValue
object
Returns
IsNumeric(string)
public static bool IsNumeric(string pString)
Parameters
pString
string
Returns
IsNumericType(object)
public static bool IsNumericType(this object o)
Parameters
o
object
Returns
IsValidName(string, bool)
public static bool IsValidName(string pName, bool pAllowStartWithUnderscore = false)
Parameters
Returns
IsValidNumber(string)
public static bool IsValidNumber(string pInputString)
Parameters
pInputString
string
Returns
ItemIn<T>(T, params T[])
public static bool ItemIn<T>(T pCheckValue, params T[] pValues) where T : IComparable
Parameters
pCheckValue
TpValues
T[]
Returns
Type Parameters
T
LCase(string)
public static string LCase(string pInputString)
Parameters
pInputString
string
Returns
Left(string, int)
public static string Left(string pString, int pCharCount)
Parameters
Returns
Len(string)
public static int Len(string pString)
Parameters
pString
string
Returns
LetFolderNameEndOnSlash(string)
Take a foldername and makes sure it ends on a backwards slash (). If the name already ends on a slash, no extra slash is added.
public static string LetFolderNameEndOnSlash(string pFolderName)
Parameters
pFolderName
stringThe name of the folder, like 'C:\Temp'
Returns
- string
The name of the folder ending on a slash, like: 'C:\Temp'
Like(string, string, bool)
public static bool Like(this string pInputString, string pMatchString, bool pCaseInSensitive = false)
Parameters
Returns
Long(int)
public static string Long(int pNumber)
Parameters
pNumber
int
Returns
LongVal(object)
Converts the specified pValue to a number and returns the long value (using floor).
public static long LongVal(object pValue)
Parameters
pValue
objectThe value to convert.
Returns
- long
A long value.
MakeNull(object)
Used to replace empty strings by DBNull values for fields that cannot contain zero-length strings.
public static object MakeNull(object pInputValue)
Parameters
pInputValue
objectA value
Returns
- object
NULL if pInputValue is an empty string or empty etc., else pInputValue is returned.
Max<T>(T, T)
Returns the maximum value from the two specified values.
public static T Max<T>(T pValue1, T pValue2) where T : IComparable
Parameters
pValue1
TpValue2
T
Returns
- T
Type Parameters
T
Merge(byte[], byte[])
public static byte[] Merge(this byte[] pSource, byte[] pAdditionalArray)
Parameters
Returns
- byte[]
MergeByteArrays(params byte[][])
public static byte[] MergeByteArrays(params byte[][] pArrays)
Parameters
pArrays
byte[][]
Returns
- byte[]
Mid(string, int, int, bool)
public static string Mid(string pInputString, int pStartPosition, int pLength = 1000000000, bool pZeroBased = false)
Parameters
Returns
Mid(string, int, int, string, bool)
public static string Mid(string pInputString, int pStartPosition, int pLength, string pReplacementValue, bool pZeroBased = false)
Parameters
Returns
MidABS(string, int, int)
public static string MidABS(string pInputString, int pStartposition, int pEndPosition)
Parameters
Returns
Min<T>(T, T)
Returns the minimum value from the to specified values.
public static T Min<T>(T pValue1, T pValue2) where T : IComparable
Parameters
pValue1
TpValue2
T
Returns
- T
Type Parameters
T
NewString(string)
public static clsString NewString(string pInitialValue = "")
Parameters
pInitialValue
string
Returns
NoEmpty(string, string)
Returns pInputValue, except when pInputValue is null or an empty string, then pEmptyValue is returned.
public static string NoEmpty(string pInputValue, string pEmptyValue)
Parameters
pInputValue
stringThe input value.
pEmptyValue
stringThe value to use when pInputValue is null or empty.
Returns
NoNull(object, object)
Takes a value and returns the specified NullValue if the value was null (nothing) or NULL.
public static object NoNull(object pInputValue, object pNullValue)
Parameters
pInputValue
objectThe input value.
pNullValue
objectThe value to substitute if the InputValue is null or NULL
Returns
- object
pInputValue ?? pNullValue.
OptionalLongVal(object)
Converts the specified pValue to a number and returns the long value (using floor). Returns null if the specified value is null or NULL or Empty.
public static long? OptionalLongVal(object pValue)
Parameters
pValue
objectThe value to convert.
Returns
- long?
A long? value
Random(int)
public static int Random(int pTopBoundary)
Parameters
pTopBoundary
int
Returns
Random(int, int)
public static int Random(int pInclusiveBottomBoundary, int pTopBoundary)
Parameters
Returns
ReDim<T>(T[], int, bool)
public static T[] ReDim<T>(T[] pVariable, int pNewSize, bool pPreserve = false)
Parameters
Returns
- T[]
Type Parameters
T
ReadFile(string, bool)
public static string ReadFile(string pPath, bool pReadBinary = true)
Parameters
Returns
ReadTag(string, string, string)
Reads a value from a tag
public static string ReadTag(string pTag, string pSetting, string pSepChar = "]")
Parameters
pTag
stringThe value of a tag, like '[Month=April][Type=Book][Color=Light blue]'
pSetting
stringThe name of the setting, including the start character and the separator, like '[Type='
pSepChar
stringThe character at the end of the settings, like ']'
Returns
- string
The value of the named item, like 'Book' or an empty string if the setting is not found.
ReleaseMutex(Mutex)
public static void ReleaseMutex(Mutex pMutex)
Parameters
pMutex
Mutex
RemoveSQLcomments(string)
public static string RemoveSQLcomments(string pSQLstring)
Parameters
pSQLstring
string
Returns
RemoveUnicodeCharactersFromString(string, string)
public static string RemoveUnicodeCharactersFromString(string pString, string pReplacementCharacter)
Parameters
Returns
RepairNumber(decimal)
public static decimal RepairNumber(decimal pValue)
Parameters
pValue
decimal
Returns
RepairNumber(double)
public static double RepairNumber(double pValue)
Parameters
pValue
double
Returns
Replace(string, string, string, int, int, int)
public static string Replace(string pSourceString, string pFindString, string pReplaceString, int pStartAt = 1, int pReplaceCount = -1, int pCompareMode = 0)
Parameters
pSourceString
stringpFindString
stringpReplaceString
stringpStartAt
intpReplaceCount
intpCompareMode
int
Returns
Right(string, int)
public static string Right(string pString, int pCharCount)
Parameters
Returns
RoundUp(double, int)
Rounds a number to its nearest whole number away from zero (or the given decimals)
public static double RoundUp(this double pValue, int pDecimals)
Parameters
Returns
- double
The rounded number.
SYSTEMTIME()
public static DateTime SYSTEMTIME()
Returns
SendDebug(params object[])
public static void SendDebug(params object[] pElements)
Parameters
pElements
object[]
SetFileExtension(string, string)
Sets a different file extension for a file name.
public static string SetFileExtension(string pFilename, string pFileExtension)
Parameters
pFilename
stringThe full file name to set the file extension for, like: 'C:\temp\Photo.jpg'
pFileExtension
stringThe new file extension, like 'png'
Returns
- string
The name with the new file extension, like: 'C:\temp\Photo.png'
SetTag(string, string, string, bool, string)
Sets a value in a tag.
public static string SetTag(string pTag, string pSetting, string value, bool pRemoveEmptySetting = false, string pSepChar = "]")
Parameters
pTag
stringThe initial value of the tag, like '[Month=April][Type=Book][Color=Light blue]'
pSetting
stringThe name of the setting, including the start character and the separator, like '[Type='
value
stringThe new value, like 'Movie'
pRemoveEmptySetting
boolPass as True to remove a setting if the value is empty.
pSepChar
stringThe character at the end of the settings, like ']'
Returns
- string
The new tag. Elements may get a different position. Like: [Month=April][Color=Light blue][Type=Movie]
Sha1(string)
public static string Sha1(string pMessage)
Parameters
pMessage
string
Returns
Sha256(string)
public static string Sha256(string pMessage)
Parameters
pMessage
string
Returns
Sha512(string)
public static string Sha512(string pMessage)
Parameters
pMessage
string
Returns
Space(int)
public static string Space(int pSpaceCount)
Parameters
pSpaceCount
int
Returns
Str(object)
Converts the specified value to a string representing this value. Uses InvariantCulture (decimal dot). Returns an empty string if the pNumber is not numeric.
public static string Str(object pNumber)
Parameters
pNumber
objectThe number to convert to a string.
Returns
- string
A string for the specified number or an empty string.
StringHasUnicodeCharacters(string)
public static bool StringHasUnicodeCharacters(string pString)
Parameters
pString
string
Returns
StringToByteArray(string)
public static byte[] StringToByteArray(string pInputString)
Parameters
pInputString
string
Returns
- byte[]
StringToHex(string)
public static string StringToHex(string pInputString)
Parameters
pInputString
string
Returns
StringToSQL(string)
public static string StringToSQL(string pString)
Parameters
pString
string
Returns
StringToSQL_EmptyStringAsNULL(string)
public static string StringToSQL_EmptyStringAsNULL(string pString)
Parameters
pString
string
Returns
StringToSQLname(string)
public static string StringToSQLname(string pName)
Parameters
pName
string
Returns
StripFileExtension(string)
Returns the name of the given pFileName but removes the extension from the file name.
public static string StripFileExtension(string pFileName)
Parameters
pFileName
stringThe (full) filename. May include folders. Like: 'C:\temp\Photo.jpg'
Returns
- string
The full filename without the extension. Like: 'C:\temp\Photo'
Swap<T>(ref T, ref T)
public static void Swap<T>(ref T pParameter1, ref T pParameter2)
Parameters
pParameter1
TpParameter2
T
Type Parameters
T
SyncShell(string, int, bool, bool)
public static bool SyncShell(string pCommandLine, int pTimeOutTicks = 0, bool pWaitForInputIdle = false, bool pRunAsAdministrator = false)
Parameters
Returns
SyncShell(string, int, ref string, ref string, bool)
public static bool SyncShell(string pCommandLine, int pTimeOutTicks, ref string pResult, ref string pErrorMessage, bool pRunAsAdministrator)
Parameters
Returns
SyncShell(string, ref string, int, bool)
public static bool SyncShell(string pCommandLine, ref string pResult, int pTimeOutTicks = 0, bool pRunAsAdministrator = false)
Parameters
Returns
SyncShell(string, ref string, ref string, int, bool)
public static bool SyncShell(string pCommandLine, ref string pResult, ref string pErrorMessage, int pTimeOutTicks = 0, bool pRunAsAdministrator = false)
Parameters
Returns
SysDateToString(DateTime, SysDateToString_Format)
public static string SysDateToString(DateTime pInputDateTime, Globals.SysDateToString_Format pFormat = SysDateToString_Format.YYYYMMDDHHMMSS)
Parameters
pInputDateTime
DateTimepFormat
Globals.SysDateToString_Format
Returns
SysStringToDate(string, SysDateToString_Format)
public static DateTime SysStringToDate(string pInputString, Globals.SysDateToString_Format pFormat = SysDateToString_Format.YYYYMMDDHHMMSS)
Parameters
pInputString
stringpFormat
Globals.SysDateToString_Format
Returns
TimeSerial(int, int, int)
public static DateTime TimeSerial(int pHours, int pMinutes, int pSeconds)
Parameters
Returns
TimeValue(DateTime)
Returns the time-part of the specified date/time.
public static DateTime TimeValue(DateTime pInputDate)
Parameters
pInputDate
DateTime
Returns
ToHTTPdate(DateTime)
public static string ToHTTPdate(this DateTime pDate)
Parameters
pDate
DateTime
Returns
ToTitleCase(string, bool)
public static string ToTitleCase(string pString, bool pRemoveSpaces = false)
Parameters
Returns
Trim(string)
public static string Trim(string pInputString)
Parameters
pInputString
string
Returns
UBound(Array, int)
public static int UBound(Array pObject, int pDimension = 1)
Parameters
Returns
UCase(string)
public static string UCase(string pInputString)
Parameters
pInputString
string
Returns
UTF8toUnicode(string)
public static string UTF8toUnicode(string pUnicodeString)
Parameters
pUnicodeString
string
Returns
UnQuote(string)
If the trimmed source string starts and ends with a double quote, these quotes are removed.
public static string UnQuote(this string pString)
Parameters
pString
string
Returns
UnSquareBracket(string)
If the trimmed source string starts and ends with a square bracked [..], these square brackets are removed.
public static string UnSquareBracket(this string pString)
Parameters
pString
string
Returns
UnicodeToUTF8(string)
public static string UnicodeToUTF8(string pUnicodeString)
Parameters
pUnicodeString
string
Returns
UrlDecode(string)
public static string UrlDecode(string pUrlEncodedString)
Parameters
pUrlEncodedString
string
Returns
UrlEncode(string)
public static string UrlEncode(string pString)
Parameters
pString
string
Returns
Val(object)
Converts the specified value to a number. Uses InvariantCulture (decimal dot).
public static double Val(object pValue)
Parameters
pValue
objectThe value to convert.
Returns
- double
A number (double).
Val(string)
Converts the specified string to a number. Also accepts &H... and 0x... expressions for hex. Uses InvariantCulture (decimal dot).
public static double Val(string pString)
Parameters
pString
stringThe number to convert.
Returns
- double
A number.
ValidateEmailAddress(ref string)
public static bool ValidateEmailAddress(ref string pEmailAddress)
Parameters
pEmailAddress
string
Returns
ValueToJSON(object)
public static string ValueToJSON(object pValue)
Parameters
pValue
object
Returns
VbDayOfWeek(DateTime, int)
public static int VbDayOfWeek(DateTime pDateTime, int pFirstDayOfWeek)
Parameters
Returns
VbWeekNumber(DateTime, int, int)
public static int VbWeekNumber(DateTime pDateTime, int pFirstWeekOfYear, int pFirstDayOfWeek)
Parameters
Returns
WPPS(string, string, string, string)
public static void WPPS(string pFileName, string pSectionName, string pKeyName, string value)
Parameters
WriteFile(string, string, bool, bool)
public static string WriteFile(string pPath, string pContents, bool pCreatePath = false, bool pWriteBinary = true)
Parameters
Returns
WriteLogLine(string, string, bool, bool)
Writes a line to a logfile as specified. If no filename is given, the file 'LogResults.txt' is used
public static void WriteLogLine(string pLine, string pFileName = "", bool pSuppressAddDateTime = false, bool pSuppressNewLine = false)
Parameters
pLine
stringThe line of text to write to the log.
pFileName
stringThe name of the file to write to. If no path is specified, the current exe-path is used. If nothing is specified, 'LogResults.txt' is used.
pSuppressAddDateTime
boolPass as True to support adding the utc date time to the beginning of the line.
pSuppressNewLine
boolPass as True to suppress adding a NewLine (Cr/Lf) to the end of the line. This way, the next WriteLogLine will continue on this line.