public static PrintingConfig <TOwner> TrimmedToLength <TOwner>( this PropertyPrintingConfig <TOwner, string> propConfig, int maxLen) { return(maxLen < 0 ? propConfig.Using(s => "") : propConfig.Using(s => s.Substring(0, Math.Min(s.Length, maxLen)))); }
public static PrintingConfig <TOwner> TrimToLength <TOwner>(this PropertyPrintingConfig <TOwner, string> config, int length) { if (length < 0) { throw new ArgumentException("Length must be positive number"); } return(config.Using(a => a.Substring(0, a.Length > length ? length : a.Length))); }
public static PrintingConfig <TOwner> Trim <TOwner>( this PropertyPrintingConfig <TOwner, string> propConfig, int maxLength) { return(propConfig.Using(str => str.Length > maxLength ? str.Substring(0, maxLength) : str)); }
public static PrintingConfig <TOwner> TrimmedToLength <TOwner>(this PropertyPrintingConfig <TOwner, string> propConfig, int maxLen) { propConfig.Using(s => { var length = Math.Min(s.Length, Math.Max(maxLen, 0)); return(s.Substring(0, length)); }); return(((IPropertyPrintingConfig <TOwner, string>)propConfig).ParentConfig); }
public static PrintingConfig <TOwner> Using <TOwner>(this PropertyPrintingConfig <TOwner, int> printingConfig, CultureInfo culture) => printingConfig.Using(x => x.ToString(culture));
public static PrintingConfig <TOwner> TrimmedToLength <TOwner>(this PropertyPrintingConfig <TOwner, string> printingConfig, int length) => printingConfig.Using(x => x.Substring(0, Math.Min(length, x.Length)));
public static PrintingConfig <TOwner> TrimmedToLength <TOwner>( this PropertyPrintingConfig <TOwner, string> propConfig, int maxLen) { propConfig.Using(x => x.Substring(0, Math.Min(maxLen, x.Length))); return(((IPropertyPrintingConfig <TOwner, string>)propConfig).ParentConfig); }
public static PrintingConfig <TOwner> Using <TOwner>(this PropertyPrintingConfig <TOwner, int> config, CultureInfo currentCulture) { return(config.Using(number => number.ToString(currentCulture))); }
public static PrintingConfig <TOwner> Using <TOwner, TPropType>( this PropertyPrintingConfig <TOwner, TPropType> printingConfig, CultureInfo cultureInfo) where TPropType : IFormattable { return(printingConfig.Using(numericValue => string.Format(cultureInfo, "{0}", numericValue))); }
public static PrintingConfig <TOwner> Trimmed <TOwner>( this PropertyPrintingConfig <TOwner, string> printingConfig, int length) { return(printingConfig.Using(str => str.Substring(0, length))); }
public static PrintingConfig <TOwner> TrimmedToLength <TOwner>(this PropertyPrintingConfig <TOwner, string> config, int maxLen) { config.Using(s => s.Substring(0, Math.Min(s.Length, maxLen))); return(((IPropertyPrintingConfig <TOwner>)config).ParentConfig); }
public static PrintingConfig <TOwner> Using <TOwner, TPropType>(this PropertyPrintingConfig <TOwner, TPropType> propConfig, CultureInfo culture) where TPropType : IFormattable { return(propConfig.Using(x => x.ToString("", culture))); }
public static PrintingConfig <TOwner> Using <TOwner, T>( this PropertyPrintingConfig <TOwner, T> config, CultureInfo culture) where T : IFormattable => config.Using(i => i.ToString("", culture));
public static PrintingConfig <TOwner> TrimmedToLength <TOwner>( this PropertyPrintingConfig <TOwner, string> config, int maxLen) => config.Using(s => s.Substring(0, Math.Min(maxLen, s.Length)));
private static PrintingConfig <TOwner> UsingCultureForNumberType <TOwner, TPropType>(PropertyPrintingConfig <TOwner, TPropType> propConfig, CultureInfo culture) { propConfig.Using(n => Convert.ToString(n, culture)); return(((IPropertyPrintingConfig <TOwner, TPropType>)propConfig).ParentConfig); }
public static PrintingConfig <TOwner> TrimmedToLength <TOwner>( this PropertyPrintingConfig <TOwner, string> propConfig, int maxLen) { return(propConfig.Using(str => TrimToLength(str, maxLen))); }
public static PrintingConfig <TOwner> Using <TOwner, TProperty>( this PropertyPrintingConfig <TOwner, TProperty> printingConfig, CultureInfo culture) where TProperty : IFormattable { return(printingConfig.Using(number => string.Format(culture, "{0}", number))); }