*** empty log message ***
[m17n/m17n-lib-cs.git] / mtext.cs
index 4ed6e5d..bc8dad5 100644 (file)
--- a/mtext.cs
+++ b/mtext.cs
@@ -7,16 +7,33 @@ public class Test
   public static void Main()
   {
     String str = "a𝄀あc";
-    MText mt = new MText (str);
+    MText mt = new MText (str), mt2;
+
+    Console.WriteLine (str + mt);
+    Console.WriteLine (mt + str);
+    Console.WriteLine (mt + 'a');
+    mt2 = mt.Dup ();
+    mt2 += str;
+    Console.WriteLine (mt2);
 
     Console.WriteLine ("{0}, Length={1}", mt, mt.Length);
     foreach (int c in mt)
       Console.WriteLine ("U+{0:X4}", c);
     Console.WriteLine (mt + new MText ("漢字"));
-
-    MText mt2 = mt.Dup ();
-    mt[1] = 'b';
+    Console.WriteLine (mt[2,4]);
+    mt[0] = '日';             // == mt.Del (0, 1); mt.Ins (0, char)
+    Console.WriteLine (mt);
+    mt[1,3] = new MText ('本');       // == mt.Del (1, 3); mt.Ins (1, mt)
+    Console.WriteLine (mt);
+    mt[1,2] = null;            // == mt.Del (1, 2)
     Console.WriteLine (mt);
+    // explicit casting (MText -> string)
+    string str2 = " " + (string) mt + (string) ((MText) "abc").Cat ('a');
+    Console.WriteLine (str2);
+    // implicit casting (string -> MText)
+    mt2 = "abc";
+    mt2.Cat ("def");
+    mt2 += "ghi";
     Console.WriteLine (mt2);
   }
 }