Strings, Numbers, Dates
All methods are under the Perigee.Extensions
namespace
Range Extraction
Range extraction allows you to split an input string into it's parts.
var rangeExtracted = "Section A, B and C";
Console.WriteLine(JsonConvert.SerializeObject(rangeExtracted.RangeExtract()));
// ["Section A","Section B","Section C"]
var rangeExtracted = "1-8";
Console.WriteLine(JsonConvert.SerializeObject(rangeExtracted.RangeExtract()));
//[" 1"," 2"," 3"," 4"," 5"," 6"," 7"," 8"]
Fast String
These methods use the fastest possible comparisons and Boolean checks available for the various tasks.
FastContains(); //contain
FastSuffix(); //suffix
FastPreFix(); //prefix
FastContainsAndPrefixOrSuffix(); //Must contain and (begin or end with)
FastContainsAndPrefix(); //contain and prefix
FastContainsAndSuffix(); //contain ans suffix
FastAndContains(); //Contain1 AND contain2, n
FastOrContains(); //Contain1 OR contain2, n
String manipulation
RemoveFromSuffix(); //Remove a suffix from a string
RemoveFromPrefix(); //Remove a prefix from a string
TrimDuplicateWhitespace(); //Replace duplicate whitespace characters in a string
Truncate(); //Truncates string so that it is no longer than the specified number of characters. Allows for negative signs
TruncateAndReport(); //Truncate a string and report if a truncation did occur
Data and object or partial detection
ReBracketString(); //Rebracket a bracketed or un-bracketed string, useful for database commands
getAllSubstrings(); //Cross application of all available substring for a given word
Soundex(); //Returns the soundex string for the word
LevenshteinDistance(); // Levenshtein distance
IsStringDate(); //Check whether a string is a date in the given(or default culture)
HasSpecialChars(); //Anything not a letter or digit
IsAllDigits(); //Are all characters digits (- sign allowed at position 0)
AlphaPercent(); //Percentage of characters that are all alpha characters. This algorithm is great for header detection
IsAllDigitsAndContainsPeriod(); //Is all digits, AND contains period
IsAllDigitsAndContainsPeriodAndCurrency(); //Checks for currency as well
StripCurrencySymbols(); //Strip currency symbols from input
StripCurrencySymbolsAndSeparators(); //Strip currency and separators
IsScientificNotation(); //Is it scientific notation?
ToInt(); //Converts a string to an integer, ignoring alpha characters and using a fast conversion algorithm
ToLong(); //Converts a string to a long, ignoring alpha characters and using a fast conversion algorithm
StripInt(); //Strip alpha charcters leading up to an integer in a string
ToDecimal(); //Convert a string to a decimal using fast conversion logic
//Decimal info provides a lot of information about a decimal, very useful when dealing with a system with strict requirements
DecimalInfo(); //Get's the decimal information, as well returns the trailing truncated version of the string.
// ^^ Returns the precision, scale, effective precision, effective scale, reparsed result if zero truncation is enabled, if truncation occured
SplitExcelLocatorToColAndRow(); //Split an excel location to the row and column (ex, Y5)
ToBase26ExcelLookup(); //Convert an excel base 26 characters string to the unsigned int reference, 1 based
ToBase26ExcelLookup_ZeroBased(); //Convert an excel base 26 characters string to the unsigned int reference, 0 based
ToExcelColumnName(); //To excel column name from an integer
Last updated