示例#1
0
        /// <summary>
        /// Trim all texts.
        /// </summary>
        /// <param name="I18NText">A text.</param>
        public static I18NText TrimAll(this I18NText I18NText)
        {
            if (I18NText == null)
            {
                return(null);
            }

            return(new I18NText(I18NText.Select(text => new KeyValuePair <LanguageCode, String>(
                                                    text.Key,
                                                    text.Value?.Trim()
                                                    ))));
        }
示例#2
0
        /// <summary>
        /// Return a substring of the given maximum length.
        /// </summary>
        /// <param name="I18NText">A text.</param>
        /// <param name="Length">The maximum length of the substring.</param>
        public static I18NText SubstringMax(this I18NText I18NText, Int32 Length)
        {
            if (I18NText == null)
            {
                return(null);
            }

            return(new I18NText(I18NText.Select(text => new KeyValuePair <LanguageCode, String>(
                                                    text.Key,
                                                    text.Value.Substring(0, Math.Min(text.Value.Length, Length))
                                                    ))));
        }