From 55a5ffa851071bb9d723748c2479f881eafe70bb Mon Sep 17 00:00:00 2001 From: handa Date: Wed, 7 Jan 2009 08:53:02 +0000 Subject: [PATCH] *** empty log message *** --- MText.cs | 12 ++++++------ temp.cs | 11 ++++++++--- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/MText.cs b/MText.cs index 7a496a5..12e482c 100644 --- a/MText.cs +++ b/MText.cs @@ -195,26 +195,26 @@ namespace M17N.Core } else { - char high = (char) (0xD800 + ((i - 0x10000) >> 10)); - char low = (char) (0xDC00 + ((i - 0x10000) & 0x3FF)); + char high = (char) (0xD800 + ((value - 0x10000) >> 10)); + char low = (char) (0xDC00 + ((value - 0x10000) & 0x3FF)); if (! surrogate_high_p (sb[i])) sb.Insert (i, 0); - sb[i++] = high; - sb[i] = low; + sb[i] = high; + sb[i + 1] = low; } } get { i = pos_to_idx (this, i); return (surrogate_high_p (sb[i]) - ? i = ((sb[i] - 0xD800) << 10) + (sb[i + 1] - 0xDC00) + 0x10000 + ? ((sb[i] - 0xD800) << 10) + (sb[i + 1] - 0xDC00) + 0x10000 : sb[i]); } } public MText dup () { - return (new MText (this.sb)); + return (new MText (sb.ToString ())); } public MText ins (int pos, ref MText mt) diff --git a/temp.cs b/temp.cs index ae5d9e2..96d66a6 100644 --- a/temp.cs +++ b/temp.cs @@ -6,15 +6,20 @@ public class Test public static void Main() { MText mt = new MText ("a𝄀あc"); + MText mt2; Console.WriteLine (mt[0]); Console.WriteLine (mt[1]); Console.WriteLine (mt[2]); Console.WriteLine (mt[3]); Console.WriteLine (mt + new MText ("漢字")); + mt2 = mt.dup (); mt[1] = 'b'; - Console.WriteLine (mt); - mt[1] = 0x1d100; - Console.WriteLine (mt); + Console.WriteLine (mt2); + + Array ary = Array.CreateInstance (typeof (int32), 1, 2, 3); + + Array.ForEach (ary, { Console.WriteLine (obj); }); + } } -- 1.7.10.4