Ejemplo n.º 1
0
        /// <summary>
        /// Construct a set of default pattern processing parameters.
        /// </summary>
        /// <param name="pattern">The pattern to process.</param>
        public PatternProcessingParameters(string pattern)
        {
            Pattern = pattern;

            CapitalizationScheme = CapitalizationScheme.NONE;

            Context = Enumerable.Empty <string>();

            Variables = new Dictionary <string, string>();

            UniqueCheck = Enumerable.Empty <string>();
        }
Ejemplo n.º 2
0
        public static String usingCapitalizationScheme(this String hostString, CapitalizationScheme capScheme)
        {
            if (hostString == null)
            {
                return("");
            }
            if (hostString.Length < 1)
            {
                return(hostString);
            }
            char          ch;
            StringBuilder sb;

            switch (capScheme)
            {
            case CapitalizationScheme.AsIs:
                return(hostString);

            case CapitalizationScheme.InitialCapital:
                ch = hostString[0];
                if (Char.IsUpper(ch))
                {
                    return(hostString);
                }
                sb = new StringBuilder();
                sb.Append(Char.ToUpper(ch));
                for (var i = 1; i < hostString.Length; i++)
                {
                    sb.Append(hostString[i]);
                }
                return(sb.ToString());

            case CapitalizationScheme.InitialLowerCase:
                ch = hostString[0];
                if (Char.IsLower(ch))
                {
                    return(hostString);
                }
                sb = new StringBuilder();
                sb.Append(Char.ToLower(ch));
                for (var i = 1; i < hostString.Length; i++)
                {
                    sb.Append(hostString[i]);
                }
                return(sb.ToString());
            }
            return(hostString);
        }