ABB.Swum.ConservativeIdSplitter.SplitOnLowercaseToUppercase C# (CSharp) Метод

SplitOnLowercaseToUppercase() приватный Метод

Splits a word where a lowercase letter is followed by an uppercase letter. The word is split at all locations where this occurs.
private SplitOnLowercaseToUppercase ( string word ) : string[]
word string The word to be split.
Результат string[]
        private string[] SplitOnLowercaseToUppercase(string word) {
            List<string> splitWords = new List<string>();
            int currentStartIndex = 0; //the index of the beginning of the current subword
            for(int i = 0; i < word.Length - 1; i++) {
                if((char.IsLower(word, i) && char.IsUpper(word, i + 1))
                   || (char.IsDigit(word, i) && !char.IsDigit(word, i + 1))
                   || (!char.IsDigit(word, i) && char.IsDigit(word, i + 1))) {
                    //found split point, add left word to list
                    splitWords.Add(word.Substring(currentStartIndex, i - currentStartIndex + 1));
                    currentStartIndex = i + 1;
                }
            }
            //add substring remaining after the last split point
            splitWords.Add(word.Substring(currentStartIndex));

            return splitWords.ToArray();
        }
    }