string ApplyStyle(string text, int i, DM.Styles style, string freq, string word, string translation) { addStyleToLeft(ref text, ref i, styles[(int)style].st1, translation); i += word.Length; addFrequency(ref text, ref i, freq); addStyleToRight(ref text, ref i, styles[(int)style].st2); return(text); }
public void StylizeWord(string word, ref string text, string freq, DM.Styles style, string translation)//not ignore { int i = text.IndexOf(word, StringComparison.CurrentCultureIgnoreCase); for (; i >= 0;) { if (IsComplete(word, text, i) && !IsInDefinition(text, i)) { int x = 0; if (IsInDefinition(text, i)) { x = 0; } text = ApplyStyle(text, i, style, freq, word, translation); int addingsLenght = ("<" + styles[(int)style].st1 + " title = '" + translation + "'" + ">").Length; //i += styles[(int)style].getLenght() + freq.Length + 1; i += addingsLenght + freq.Length + 1; } i = text.IndexOf(word, i + 2, StringComparison.CurrentCultureIgnoreCase); } }