- Utilities
Utilities
Namespace: Shared
Assembly: SharedLib
Utilities classMethods
LongToIP(Int64) | Converts a Long to an IP Address |
IPToLong(String) | Converts an IP Address to a long |
LocalIPAddresses() | Returns a list of all local network addresses |
LocalIPAddress(String) | Determines wether an IP address is a local ip address |
RandomString(Int32) | Creates a random string |
RandomNumber(Int32, Int32) | Creates a random number |
GetRandomWord(Int32, String) | Generates a random word |
CurrentPath(Boolean) | Returns the current path |
ConnectionStringValue(String, String) | Takes a connection string and returns a parameter value |
ProcessKill(String) | Kills all processes with filename |
GetCurrencySymbol(String) | Gets the currency symbol for a specific culture |
GetCurrencySymbol(String, String) | Gets the currency symbol for a specific culture |
GetCurrencySymbol(Globalization.CultureInfo) | Gets the currency symbol for a specific culture |
GetCurrencySymbol(Globalization.CultureInfo, String) | Gets the currency symbol for a specific culture |
FirstCharLower(String) | |
TextMaxLength(String, UInt32) | Ensures a string does not exceed a maximum length, if it does, cut's it to maximum length required if value is null, returns String.Empty |
WordWrap(String, Int32) | |
RemoveDblQuotes(String) | Removes double quotes surrounding a string, if they exist |
SplitCamelCase(String) | Splits a string into words using uppercase char as option to split |
DoubleToDate(DateTime, Double) | Converts a double value to a time value |
DoubleToDate(DateTime, Double, Int32) | Converts a double value to a time value |
DateToDouble(DateTime) | Converts the time element of a datetime object to a double value |
TimeToDouble(DateTime) | Converts the time to a double |
TimeToDouble(String) | Converts a string to a double |
DoubleToTime(Double) | Converts a double into a time |
StrToInt64(String, Int64) | Converts a string to an Int64 |
StrToInt(String, Int32) | Converts a string to a number |
StrToIntDef(String, Int32) | Attempts to convert a string to an int value |
StrToInt64Def(String, Int64) | Converts a string to an Int64, provides a default value. |
StrToBool(String, Boolean) | Converts a string to a boolean value |
StrToBool(String) | Converts a string to a bool with default value of false |
StrToDateTime(String, String) | Converts a string to a date time using specified culture |
StrToDateTime(String, Globalization.CultureInfo) | Converts a string to a date time using specified culture |
DateTimeToStr(DateTime, String) | Converts a date/time to a string using specified culture |
DateTimeToStr(DateTime, Globalization.CultureInfo) | Converts a date/time to a string using specified culture |
StrIsCurrency(String, Decimal) | Determines if a string value is a currency or not |
StrIsDate(String, DateTime) | Determines wether the string passed is a date or not |
StrIsDate(String, DateTime, Globalization.CultureInfo) | Determines wether the string passed is a date or not |
StrIsNumeric(String, Int64) | Looks at a string and determines wether it's a numeric value or not |
BoolToStr(Boolean) | Converts a boolean value to a string |
StrToDecimal(String, Decimal, Globalization.CultureInfo) | Converts a string value to a decimal |
StrToDblDef(String, Double) | Converts a string to a double |
StrToDbl(String) | Converts a string to a double |
StrToIntDef(String, Int64) | Converts a string to an Int64 |
StrToUInt(String, UInt32) | Converts a string to an uint |
ConvertMinTomSecDef(String, String) | Converts minutes into miliseconds |
ConvertMinTomSecDef(Int32, Int32) | Converts minutes to Milliseconds |
TryParse(String) | Attempts to convert a string to int |
ConvertmSecToMinDef(String, String) | Converts miliseconds into minutes |
StrToInt(String, Int16) | Converts a string to a shortint (Int16) |
FormatPhoneNumber(String) | Attempts to format a phone number for UK |
IsValidEmail(String) | Determines wether a string contains a correctly formatted email or not This does not check wether the email address physically exists, only that it is correctly formatted, i.e. me@domain.com |
ConvertKMtoMiles(Double) | Converts Kilometres to Miles |
ProperCase(String) | Converts a string to proper case |
IsValidUKPostcode(String, String) | Determines wether the postcode is a valid UK post code |
TimeToString(Int32) | Converts a time to a string value |
DateToStr(DateTime, String) | Converts a date to a string using specified culture |
DateToStr(DateTime, Globalization.CultureInfo) | Converts a date to a string using specified culture |
RandomPassword(Int32) | |
GetRandomPassword(Int32, String) | |
RemoveHTMLElements(String) | Removes some HTML Elements |
FileDeleteOlder(String, String, Int32) | Delete's files matching searchpattern, in folder which have not been accessed for maxDays |
FileSize(Int64, Int32) | Returns a description of the file size |
FileSize(String) | Gets the size of a file |
FileRename(String, String, String) | Rename's all files within a folder if the filename contains specific text e.g. FileRename("c:\\myfiles\\", " (2)", "_2"); looks for any file with (2) in the file name ("text file (2).txt") and renames it to ("text file_2.txt") |
FileCRC(String, Boolean) | Obtains a CRC for a given file |
DateFormat(Boolean, Boolean) | Gets the current date / time format based on culture |
Between(Int32, Int32, Int32) | Determines wether value is between two values |
MinimumValue(Int32, Int32) | Checks a value is at least Minimum |
RoundUp(Int32, Int32) | Rounds up an int value |
IsRightToLeftCharacter(String) | Detects if any characters are right to left within a string |
FormatDate(DateTime, String, String) | Formats a date for a specific culture |
FormatText(String, String) | Format's text removing any characters not part of allowed characters param |
ValueWithin(Int32, Int32, Int32) | enusres a int value is between minimum and maximum value |
MaximumLength(String, Int32) | Returns s to maximum length specified |
GetRandomPassword() | Generates a random password which is 10 characters long |
GetRandomKey() | Generates a random key value in the form LLL-NNNNNN Where L is a letter and N is a number |
Hash(String) | Creates a hash of a string From: https://stackoverflow.com/questions/8820399/c-sharp-4-0-how-to-get-64-bit-hash-code-of-given-string |
HashStringMD5(String) | Converts a string to an MD5 value |
BufferText(String, Int32) | Buffers text ensuring it's a specified length Appends spaces to the string |
Percentage(Double, Double) | Calculates a percentage |
Percentage(Int32, Int32) | Calculates a percentage |
GetWeek() | Returns the week number for today's date |
GetWeek(DateTime) | Returns the week number for the date |
Encrypt(String, String) | Encrypts a string using key provided |
Decrypt(String, String) | Decrypts an encrypted string |
EncryptDecrypt(String, Int32) | Simple encryption/decryption |
Encrypt(String) | Simple string encryption |
Decrypt(String) | Simple string decryption |
DateWithin(DateTime, Int32) | Determines wether the date falls within a number of days from current date |
DateWithin(DateTime, DateTime, DateTime, Boolean) | Checks to see if a date falls between 2 other dates |
DateWithin(DateTime, DateTime, DateTime, DateTime) | Checks to see if a date falls within two dates |
CheckMinMax(Int32, Int32, Int32) | Checks a value ensuring it is between an upper/lower limit |
CheckMinMax(UInt32, UInt32, UInt32) | Checks a value ensuring it is between an upper/lower limit |
CheckMinMaxU(UInt64, UInt64, UInt64) | Checks a value ensuring it is between an upper/lower limit |
CheckMinMax(Decimal, Decimal, Decimal) | Checks a value ensuring it is between an upper/lower limit |
CheckMinMax(Double, Double, Double) | Checks a value ensuring it is between an upper/lower limit |
AddTrailingBackSlash(String) | Ensures the string s has a trailing backslash |
ValidateTextExists(String, String, Int32, Int32) | Validates a string exists and meets min/max length requirements |
ValidateIPAddress(String) | Validates that the string representation of an IP Address is valid |
ValidateDomainName(String, Boolean, Int32) | Validates a domain name ensuring it is valid |
ValidateEmail(String) | Validates an Email Address ensuring it is valid |
XMLSetValue(String, String, String, String) | Set's an XML value in a file |
SaveEmailCredentials(String, String, String, String, Int32, Boolean) | Saves Email Credentials to file |
FileWrite(String, String) | saves a string to a file Overwrites if file already exists |
FileRead(String, Boolean, Int32) | Opens a file, returns the contents |
FileEncryptedWrite(String, String, String) | Encrypts a string and saves it to a file Overwrites if file already exists |
FileEncryptedRead(String, String) | Opens a file, decrypts the contents |
GetDatabasePart(String, String) | Retrieves part of a database connection string |
VATRemove(Decimal, Decimal) | Removes Vat/Tax at a specific rate |
VATCalculatePaid(Decimal, Decimal) | Determines how much vat/tax has been paid at a specific rate |
VATCalculate(Decimal, Decimal) | Calculates how much vat/tax will be applied at a specific rate |
BankersRounding(Decimal, Int32) | Converts a value using bankers rounding to a specific number of decimal places |
FormatMoney(Decimal, Globalization.CultureInfo, Int32, Decimal, Boolean, String) | Formates a monetary value for display |
FormatMoney(Decimal, Globalization.CultureInfo, Decimal, Boolean, String) | Format's Money for display |