X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=MText.cs;h=b28180898a25d02e4266c77f10df1f3d6c90327d;hb=948496e0c55cfffced24b1053d17b19a9369f747;hp=9180c6204ef280b9e9e31bd9f9d2777a1a4d5b32;hpb=471297b4ac15917a2500cc391f2f1e28311e4308;p=m17n%2Fm17n-lib-cs.git diff --git a/MText.cs b/MText.cs index 9180c62..b281808 100644 --- a/MText.cs +++ b/MText.cs @@ -227,6 +227,16 @@ namespace M17N.Core public override string ToString () { return sb.ToString (); } + public static implicit operator MText (string str) + { + return new MText (str); + } + + public static explicit operator string (MText mt) + { + return mt.ToString (); + } + private static int inc_idx (StringBuilder sb, int i) { return (i + (Char.IsHighSurrogate (sb[i]) ? 2 : 1)); @@ -462,6 +472,11 @@ namespace M17N.Core return this; } + public MText Del () + { + return Del (0, Length); + } + public MText Del (int from, int to) { if (check_range (from, to, true)) @@ -621,7 +636,8 @@ namespace M17N.Core public object FindProp (MSymbol key, int pos, out int from, out int to) { - from = to = pos; + from = 0; + to = Length; check_pos (pos, false); MInterval i = (MInterval) intervals.Get (key);