private static void AddVowelToEachLetter(char[] text, List <LetterWithColor> letterWithColorList) { foreach (var c in text) { var mytext = FindTheVaul.HebrewCharsExtensions.GetHebrewCharType(c); if (mytext == HebrewCharTypes.Letter) { if (_lastChar == HebrewCharTypes.Letter) { letterWithColorList[letterWithColorList.Count - 1].VowelAsciiCode = '1'; } letterWithColorList.Add(new LetterWithColor() { Letter = c }); } else if (mytext == HebrewCharTypes.Vowel) { letterWithColorList[letterWithColorList.Count - 1].VowelAsciiCode = c; } else if (_lastChar == HebrewCharTypes.Letter) { letterWithColorList.Add(new LetterWithColor() { Letter = c }); } _lastChar = mytext; } if (_lastChar == HebrewCharTypes.Letter) { letterWithColorList[letterWithColorList.Count - 1].VowelAsciiCode = '1'; } }
public static bool IsHebrew(this char c, HebrewCharTypes charTypes) { foreach (var kv in Map.Where(ct => charTypes.HasFlag(ct.Key))) { var locMap = kv.Value; for (int i = 0; i <= locMap.GetUpperBound(0); i++) { if (c >= locMap[i, 0] && c <= locMap[i, 1]) { return(true); } } } return(false); }
private static IEnumerable <char> GetHebChars2(HebrewCharTypes charTypes) { int iii = 1; foreach (var kv in Map.Where(ct => charTypes.HasFlag(ct.Key))) { var locMap = kv.Value; for (int i = 0; i <= locMap.GetUpperBound(0); i++) { var start = locMap[i, 0]; var end = locMap[i, 1]; foreach (var ch in Enumerable.Range(start, end - start + 1)) { yield return((char)ch); } } } }