示例#1
0
        public static void DectectInputFormat(string str, out InputFormats inputFormat, out InputDigitLanguages inputDigitLanguage)
        {
            inputFormat = InputFormats.Digits;

            if (str[0] == '-' || str[0] == '+')
            {
                inputFormat = InputFormats.DigitsWithSign;
            }

            inputDigitLanguage = NumberParsersSuggestions.DetectInputDigitLanguage(str);

            if (inputDigitLanguage == InputDigitLanguages.None)
            {
                inputFormat = InputFormats.Letters;
            }
        }
        private void PopulateInputFormats()
        {
            var inputFormats = new Dictionary <string, List <ListItem> >();

            foreach (var formatInfo in DocumentFormatInfo.Enumerate(DocumentFormatSupport.Load))
            {
                List <ListItem> groupData;
                if (!inputFormats.TryGetValue(formatInfo.Group.Description, out groupData))
                {
                    groupData = new List <ListItem>();
                    inputFormats.Add(formatInfo.Group.Description, groupData);
                }
                groupData.Add(new ListItem(formatInfo.Description, formatInfo.Value.ToString()));
                InputFormatCount++;
            }

            InputFormats.DataSource = inputFormats;
            InputFormats.DataBind();
        }
        public static string InputFormat(this string input, InputFormats flags)
        {
            if ((flags & InputFormats.IgnoreCase) != InputFormats.IgnoreCase)
            {
                if ((flags & InputFormats.UpperCase) == InputFormats.UpperCase)
                {
                    input = input.ToUpper();
                }
                else if ((flags & InputFormats.LowerCase) == InputFormats.LowerCase)
                {
                    input = input.ToLower();
                }
            }

            if ((flags & InputFormats.Trim) == InputFormats.Trim)
            {
                input = input.Trim();
            }
            else if ((flags & InputFormats.TrimStart) == InputFormats.TrimStart)
            {
                input = input.TrimStart();
            }
            else if ((flags & InputFormats.TrimEnd) == InputFormats.TrimEnd)
            {
                input = input.TrimEnd();
            }

            if ((flags & InputFormats.EnglishNumber) == InputFormats.EnglishNumber)
            {
                input = input.ToEnglishNumber();
            }
            if ((flags & InputFormats.Uniform) == InputFormats.Uniform)
            {
                input = input.Uniform();
            }

            return(input);
        }
示例#4
0
 public KeyValuePair <OutputFormats, OutputDigitLanguages> GetValueForKey(InputFormats inpFormat, InputDigitLanguages inpLang)
 {
     return(GetValueForKey(new KeyValuePair <InputFormats, InputDigitLanguages>(inpFormat, inpLang)));
 }
示例#5
0
 public bool ContainsKey(InputFormats inpFormat, InputDigitLanguages inpLang)
 {
     return(ContainsKey(new KeyValuePair <InputFormats, InputDigitLanguages>(inpFormat, inpLang)));
 }
示例#6
0
 public InputFormatAttribute(InputFormats flags)
 {
     _flags = flags;
 }
示例#7
0
 public InputFormatAttribute()
 {
     _flags = InputFormats.Normal;
 }