예제 #1
0
 public void IndexOf()
 {
     Assert.AreEqual(0, hello.IndexOf('h'));
     Assert.AreEqual(1, hello.IndexOf('e'));
     Assert.AreEqual(2, hello.IndexOf('l'));
     Assert.AreEqual(10, kosmex.IndexOf(0x41));
 }
예제 #2
0
        static void Recalc(ustring textStr, List <ustring> lineResult, int width, TextAlignment talign)
        {
            lineResult.Clear();
            if (textStr.IndexOf('\n') == -1)
            {
                lineResult.Add(ClipAndJustify(textStr, width, talign));
                return;
            }
            int textLen = textStr.Length;
            int lp      = 0;

            for (int i = 0; i < textLen; i++)
            {
                Rune c = textStr[i];

                if (c == '\n')
                {
                    lineResult.Add(ClipAndJustify(textStr[lp, i], width, talign));
                    lp = i + 1;
                }
            }
        }