src/DiegoRangel.DotNet.Framework.CQRS.Infra.CrossCutting/Extensions/StringExtensions.cs
/// <summary>
/// Returns the string text Formated as a Key
/// </summary>
/// <param name="unformattedKey"></param>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="unformattedKey"/> is null</exception>
Returns the string text Formated as a Key
Returns the string text Formated as a Key
public static string ToFormatedKey(this string unformattedKey)
        {
            var result = new StringBuilder();
            var currentPosition = 0;
            while (currentPosition + 4 < unformattedKey.Length)
            {
                result.Append(unformattedKey.Substring(currentPosition, 4)).Append(" ");
                currentPosition += 4;
            }
            if (currentPosition < unformattedKey.Length)
                result.Append(unformattedKey.Substring(currentPosition));
            return result.ToString().ToLowerInvariant();
        }
public static string ToFormatedKey ( this string unformattedKey ) { var result = new StringBuilder ( ) ; var currentPosition = 0 ; while ( currentPosition + 4 < unformattedKey . Length ) { result . Append ( unformattedKey . Substring ( currentPosition , 4 ) ) . Append ( " " ) ; currentPosition += 4 ; } if ( currentPosition < unformattedKey . Length ) result . Append ( unformattedKey . Substring ( currentPosition ) ) ; return result . ToString ( ) . ToLowerInvariant ( ) ; }
Returns the string text Formated as a Key
Returns the string text Formated as a Key
Thrown if  is null
Thrown if is null
string
this
unformattedKey
None