Business.EditPlaylistBusiness.GetRatingInitials C# (CSharp) Метод

GetRatingInitials() публичный Метод

Returns the 3 first letters of a rating category or the first letter of each word.
public GetRatingInitials ( string text ) : string
text string
Результат string
        public string GetRatingInitials(string text) {
            string[] Words = text.Replace('-', ' ').Split(' ');
            if (Words.Length == 0)
                return "";
            else if (Words.Length == 1 && Words[0].Length > 4)
                return text.Substring(0, 3);
            else if (Words.Length == 1)
                return Words[0];
            else {
                // Several words, return the first letter of each word.
                return new string(Words.Select(w => w[0]).ToArray()).ToUpper();
            }
        }