示例#1
0
        public static object GetFormattedValue(string formatString, object value, System.Globalization.CultureInfo culture,
                                               TextCaseFormat outStringCaseFormat)
        {
            object o = GetFormattedValue(formatString, value, culture);

            if (o == null)
            {
                return(null);
            }

            switch (outStringCaseFormat)
            {
            case TextCaseFormat.Lower:
                return(o.ToString().ToLower());

            case TextCaseFormat.Upper:
                return(o.ToString().ToUpper());

            default:
                return(o.ToString());
            }
        }
示例#2
0
        public static object GetFormattedValue(string formatString, object value, System.Globalization.CultureInfo culture)
        {
            string displayFormat = GetDisplayFormat(formatString);

            return(string.IsNullOrEmpty(displayFormat) ? value : string.Format(culture, displayFormat, value));
        }