示例#1
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Return the full 32-bit character starting at position ich in st
 /// </summary>
 /// <param name="st">The string.</param>
 /// <param name="ich">The character position.</param>
 /// <returns></returns>
 /// ------------------------------------------------------------------------------------
 public static int FullCharAt(string st, int ich)
 {
     if (Surrogates.IsLeadSurrogate(st[ich]))
     {
         return(Surrogates.Int32FromSurrogates(st[ich], st[ich + 1]));
     }
     return(Convert.ToInt32(st[ich]));
 }
示例#2
0
 [TestCase(new[] { '\xD800', 'c' }, 1, ExpectedResult = 0)]           // no double move on bad leader at start
 public int PrevChar_InvalidChar(char[] st, int ich)
 {
     // NUnit doesn't allow tests with invalid strings in a testcase, so we create the
     // string from the character array when running the test
     return(Surrogates.PrevChar(new string(st), ich));
 }
示例#3
0
 [TestCase("\xD800\xDC00c", 2, ExpectedResult = 0)]         // double move succeeds at start (and end)
 public int PrevChar(string st, int ich)
 {
     return(Surrogates.PrevChar(st, ich));
 }
示例#4
0
 public int NextChar(string st, int ich)
 {
     return(Surrogates.NextChar(st, ich));
 }