IsUpper() 공개 정적인 메소드

public static IsUpper ( char c ) : bool
c char
리턴 bool
예제 #1
0
        /// <summary>
        /// Breaks apart an event key into the individual and normalized key and
        /// any modifiers.
        /// </summary>
        /// <param name="evt">The evt.</param>
        /// <param name="key">The key.</param>
        /// <param name="modifiers">The mod.</param>
        public static void DecomposeKeys(
            EventKey evt,
            out Key key,
            out ModifierType modifiers)
        {
            // Use the keymap to decompose various elements of the hardware keys.
            uint keyval;
            int  effectiveGroup,
                 level;
            ModifierType consumedModifiers;

            keymap.TranslateKeyboardState(
                evt.HardwareKeycode,
                evt.State,
                evt.Group,
                out keyval,
                out effectiveGroup,
                out level,
                out consumedModifiers);

            // Break out the identified keys and modifiers.
            key       = (Key)keyval;
            modifiers = evt.State & ~consumedModifiers;

            // Normalize some of the keys that don't make sense.
            if (key == Key.ISO_Left_Tab)
            {
                key        = Key.Tab;
                modifiers |= ModifierType.ShiftMask;
            }

            // Check to see if we are a character and pull out the shift key if
            // it is a capital letter. This is used to normalize so all the
            // keys are uppercase with a shift modifier.
            bool shiftWasConsumed = ((evt.State ^ modifiers) & ModifierType.ShiftMask)
                                    != 0;
            var unicode = (char)Keyval.ToUnicode((uint)key);

            if (shiftWasConsumed && Char.IsUpper(unicode))
            {
                modifiers |= ModifierType.ShiftMask;
            }

            if (Char.IsLetter(unicode) &&
                Char.IsLower(unicode))
            {
                key = (Key)Char.ToUpper(unicode);
            }
        }
예제 #2
0
        /// <summary>
        /// Spacifies a string value by adding a separator (usually space) between words
        /// </summary>
        /// <param name="value">The string value to spacify</param>
        /// <param name="separator">The separator value to use, default is a space</param>
        /// <returns>The spacified string value</returns>
        public static string Spacify(this string value, string separator = " ")
        {
            if (String.IsNullOrEmpty(value) || value.Contains(separator))
            {
                return(value);
            }
            else
            {
                var result       = String.Empty;
                var previousChar = '\0';

                foreach (var currentChar in value)
                {
                    if (previousChar != Char.MinValue && Char.IsLetter(currentChar))
                    {
                        if ((Char.IsNumber(previousChar) && !Char.IsNumber(currentChar)) || (Char.IsUpper(currentChar) && Char.IsLower(previousChar)))
                        {
                            result += separator + Convert.ToString(currentChar);
                        }
                        else
                        {
                            result += Convert.ToString(currentChar);
                        }
                    }
                    else
                    {
                        result += Convert.ToString(currentChar);
                    }

                    previousChar = currentChar;
                }

                if (false == String.IsNullOrEmpty(result))
                {
                    result = result.Replace("_", separator).Replace("  ", " ");
                }

                return(result);
            }
        }
예제 #3
0
 public static Boolean IsUpper(this Char c)
 {
     return(Char.IsUpper(c));
 }