Candor.StringExtensions.LexicalAdd C# (CSharp) Method

LexicalAdd() public static method

Performs a lexicographical addition to a string by any amount. See http://wikipedia.org/wiki/Lexicographical_order, and further remarks for this member.

This may or may not result in a value that sorts in the correct order as if it were a file name in a file explorer.

If the string is at the highest character for each position or the number added moves past that position, then a new character position is incremented to the left (by adding a character position). This then behaves the same as if the source was left whitespace padded. Performance scales based on the number of characters incremented in the string.

Incrementing the value always starts on the right and moves left as with numeric additions. Right whitespace padded strings will increment values in the whitespace before advancing to the characters on the left. If this is not desired behavior then Trim the source when passed into this method.

public static LexicalAdd ( this source, LexicalCharacterSet charSet, System.Boolean ignoreCase, Int32 count ) : String
source this The string to increment from.
charSet LexicalCharacterSet The character set defining the characters and their order.
ignoreCase System.Boolean Specifies if case should be ignored as an incremented value. /// If true, incremented character positions will be the case of the majority of other /// values; which may or may not be the same as the character being replaced.
count System.Int32
return String
        public static String LexicalAdd(this String source, LexicalCharacterSet charSet, Boolean ignoreCase, Int32 count)
        {
            return LexicalAdd(source, charSet, ignoreCase, false, count);
        }

Same methods

StringExtensions::LexicalAdd ( this source, LexicalCharacterSet charSet, System.Boolean ignoreCase, System.Boolean treatNonCharsAsSpace, Int32 count ) : String