Use Joiner instead of StringBuilder, in some places.

Use String concatination in others (it's faster in actionscript than in Java)


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5959 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2009-09-16 21:13:07 +00:00
parent 9f967dd575
commit 055aac9b55
23 changed files with 102 additions and 214 deletions
@@ -21,9 +21,7 @@
package com.threerings.io { package com.threerings.io {
import com.threerings.util.ClassUtil; import com.threerings.util.Joiner;
import com.threerings.util.StringBuilder;
import com.threerings.util.StringUtil;
/** /**
* A simple serializable object implements the {@link Streamable} * A simple serializable object implements the {@link Streamable}
@@ -49,19 +47,18 @@ public class SimpleStreamableObject implements Streamable
*/ */
public function toString () :String public function toString () :String
{ {
var buf :StringBuilder = new StringBuilder("["); var j :Joiner = Joiner.createFor(this);
buf.append(ClassUtil.tinyClassName(this)).append("("); toStringJoiner(j);
toStringBuilder(buf); return j.toString();
return buf.append(")]").toString();
} }
/** /**
* Handles the toString-ification of all public members. Derived * Handles the toString-ification of all public members. Derived
* classes can override and include non-public members if desired. * classes can override and include non-public members if desired.
*/ */
protected function toStringBuilder (buf :StringBuilder): void protected function toStringJoiner (j :Joiner): void
{ {
StringUtil.fieldsToString(buf, this); j.addFields(this);
} }
} }
} }
@@ -25,7 +25,7 @@ import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream; import com.threerings.io.ObjectOutputStream;
import com.threerings.util.Boxed; import com.threerings.util.Boxed;
import com.threerings.util.StringBuilder; import com.threerings.util.Joiner;
/** /**
* An attribute changed event is dispatched when a single attribute of a * An attribute changed event is dispatched when a single attribute of a
@@ -107,11 +107,10 @@ public class AttributeChangedEvent extends NamedEvent
} }
// documentation inherited // documentation inherited
override protected function toStringBuf (buf :StringBuilder) :void override protected function toStringJoiner (j :Joiner) :void
{ {
buf.append("CHANGE:"); super.toStringJoiner(j);
super.toStringBuf(buf); j.add("value", _value);
buf.append(", value=", _value);
} }
override public function writeObject (out :ObjectOutputStream) :void override public function writeObject (out :ObjectOutputStream) :void
@@ -24,8 +24,8 @@ package com.threerings.presents.dobj {
import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream; import com.threerings.io.ObjectOutputStream;
import com.threerings.util.Joiner;
import com.threerings.util.StreamableArrayList; import com.threerings.util.StreamableArrayList;
import com.threerings.util.StringBuilder;
/** /**
* Used to manage and submit groups of events on a collection of distributed objects in a single * Used to manage and submit groups of events on a collection of distributed objects in a single
@@ -90,15 +90,10 @@ public class CompoundEvent extends DEvent
} }
// from DObject // from DObject
override protected function toStringBuf (buf :StringBuilder) :void override protected function toStringJoiner (j :Joiner) :void
{ {
buf.append("COMPOUND:"); super.toStringJoiner(j);
super.toStringBuf(buf); j.addArgsArray(_events.asArray());
var nn :int = _events.size();
for (var ii :int = 0; ii < nn; ii++) {
buf.append(", ", _events.get(ii));
}
} }
// from DObject // from DObject
+8 -10
View File
@@ -25,7 +25,7 @@ import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream; import com.threerings.io.ObjectOutputStream;
import com.threerings.io.Streamable; import com.threerings.io.Streamable;
import com.threerings.util.StringBuilder; import com.threerings.util.Joiner;
public /* abstract */ class DEvent public /* abstract */ class DEvent
implements Streamable implements Streamable
@@ -96,21 +96,19 @@ public /* abstract */ class DEvent
*/ */
public function toString () :String public function toString () :String
{ {
var buf :StringBuilder = new StringBuilder(); var j :Joiner = Joiner.createFor(this);
buf.append("["); toStringJoiner(j);
toStringBuf(buf); return j.toString();
buf.append("]");
return buf.toString();
} }
/** /**
* This should be overridden by derived classes (which should be sure * This should be overridden by derived classes (which should be sure
* to call <code>super.toString()</code>) to append the derived class * to call <code>super.toStringJoiner()</code> first) to append the derived class
* specific event information to the string buffer. * specific event information onto the String representation.
*/ */
protected function toStringBuf (buf :StringBuilder) :void protected function toStringJoiner (j :Joiner) :void
{ {
buf.append("targetOid=", _toid); j.add("targetOid", _toid);
} }
/** The oid of the object that is the target of this event. */ /** The oid of the object that is the target of this event. */
+11 -12
View File
@@ -26,8 +26,8 @@ import flash.errors.IllegalOperationError;
import flash.events.EventDispatcher; import flash.events.EventDispatcher;
import com.threerings.util.ClassUtil; import com.threerings.util.ClassUtil;
import com.threerings.util.Joiner;
import com.threerings.util.Log; import com.threerings.util.Log;
import com.threerings.util.StringBuilder;
import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream; import com.threerings.io.ObjectOutputStream;
@@ -157,34 +157,33 @@ public class DObject // extends EventDispatcher
*/ */
public function which () :String public function which () :String
{ {
var buf :StringBuilder = new StringBuilder(); var j :Joiner = Joiner.createFor(this);
whichBuf(buf); whichJoiner(j);
return buf.toString(); return j.toString();
} }
/** /**
* Used to briefly describe this distributed object. * Used to briefly describe this distributed object.
*/ */
protected function whichBuf (buf :StringBuilder) :void protected function whichJoiner (j :Joiner) :void
{ {
buf.append(ClassUtil.shortClassName(this), ":", _oid); j.addArgs(_oid);
} }
// documentation inherited // documentation inherited
public function toString () :String public function toString () :String
{ {
var buf :StringBuilder = new StringBuilder("["); var j :Joiner = Joiner.createFor(this);
toStringBuf(buf); toStringJoiner(j);
buf.append("]"); return j.toString();
return buf.toString();
} }
/** /**
* Generates a string representation of this object. * Generates a string representation of this object.
*/ */
public function toStringBuf (buf :StringBuilder) :void public function toStringJoiner (j :Joiner) :void
{ {
buf.append("oid=", _oid); j.add("oid", _oid);
} }
/** /**
+1 -5
View File
@@ -26,7 +26,6 @@ import com.threerings.util.Cloneable;
import com.threerings.util.Equalable; import com.threerings.util.Equalable;
import com.threerings.util.Iterator; import com.threerings.util.Iterator;
import com.threerings.util.Log; import com.threerings.util.Log;
import com.threerings.util.StringBuilder;
import com.threerings.util.Util; import com.threerings.util.Util;
import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectInputStream;
@@ -225,10 +224,7 @@ public class DSet
*/ */
public function toString () :String public function toString () :String
{ {
var buf :StringBuilder = new StringBuilder("("); return "(" + _entries.toString() + ")";
buf.append(_entries.toString());
buf.append(")");
return buf.toString();
} }
// documentation inherited from interface Streamable // documentation inherited from interface Streamable
@@ -25,7 +25,7 @@ import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream; import com.threerings.io.ObjectOutputStream;
import com.threerings.util.Boxed; import com.threerings.util.Boxed;
import com.threerings.util.StringBuilder; import com.threerings.util.Joiner;
/** /**
* An element updated event is dispatched when an element of an array * An element updated event is dispatched when an element of an array
@@ -132,12 +132,10 @@ public class ElementUpdatedEvent extends NamedEvent
} }
// documentation inherited // documentation inherited
override protected function toStringBuf (buf :StringBuilder) :void override protected function toStringJoiner (j :Joiner) :void
{ {
buf.append("UPDATE:"); super.toStringJoiner(j);
super.toStringBuf(buf); j.add("value", _value, "index", _index);
buf.append(", value=", _value);
buf.append(", index=", _index);
} }
protected var _value :Object; protected var _value :Object;
@@ -24,8 +24,8 @@ package com.threerings.presents.dobj {
import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream; import com.threerings.io.ObjectOutputStream;
import com.threerings.util.Joiner;
import com.threerings.util.Log; import com.threerings.util.Log;
import com.threerings.util.StringBuilder;
/** /**
* An entry added event is dispatched when an entry is added to a {@link * An entry added event is dispatched when an entry is added to a {@link
@@ -88,11 +88,10 @@ public class EntryAddedEvent extends NamedEvent
} }
// documentation inherited // documentation inherited
override protected function toStringBuf (buf :StringBuilder) :void override protected function toStringJoiner (j :Joiner) :void
{ {
buf.append("ELADD:"); super.toStringJoiner(j);
super.toStringBuf(buf); j.add("entry", _entry);
buf.append(", entry=", _entry);
} }
override public function writeObject (out :ObjectOutputStream) :void override public function writeObject (out :ObjectOutputStream) :void
@@ -25,8 +25,8 @@ import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream; import com.threerings.io.ObjectOutputStream;
import com.threerings.util.Boxed; import com.threerings.util.Boxed;
import com.threerings.util.Joiner;
import com.threerings.util.Log; import com.threerings.util.Log;
import com.threerings.util.StringBuilder;
/** /**
* An entry removed event is dispatched when an entry is removed from a * An entry removed event is dispatched when an entry is removed from a
@@ -107,11 +107,10 @@ public class EntryRemovedEvent extends NamedEvent
} }
// documentation inherited // documentation inherited
override protected function toStringBuf (buf :StringBuilder) :void override protected function toStringJoiner (j :Joiner) :void
{ {
buf.append("ELREM:"); super.toStringJoiner(j);
super.toStringBuf(buf); j.add("key", _key);
buf.append(", key=", _key);
} }
override public function writeObject (out :ObjectOutputStream) :void override public function writeObject (out :ObjectOutputStream) :void
@@ -24,8 +24,8 @@ package com.threerings.presents.dobj {
import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream; import com.threerings.io.ObjectOutputStream;
import com.threerings.util.Joiner;
import com.threerings.util.Log; import com.threerings.util.Log;
import com.threerings.util.StringBuilder;
/** /**
* An entry updated event is dispatched when an entry of a {@link DSet} is * An entry updated event is dispatched when an entry of a {@link DSet} is
@@ -89,8 +89,7 @@ public class EntryUpdatedEvent extends NamedEvent
_oldEntry = dset.update(_entry); _oldEntry = dset.update(_entry);
if (_oldEntry == null) { if (_oldEntry == null) {
// complain if we didn't update anything // complain if we didn't update anything
Log.getLog(this).warning("No matching entry to update " + Log.getLog(this).warning("No matching entry to update", "entry", this, "set", dset);
"[entry=" + this + ", set=" + dset + "].");
return false; return false;
} }
} }
@@ -106,11 +105,10 @@ public class EntryUpdatedEvent extends NamedEvent
} }
// documentation inherited // documentation inherited
override protected function toStringBuf (buf :StringBuilder) :void override protected function toStringJoiner (j :Joiner) :void
{ {
buf.append("ELUPD:"); super.toStringJoiner(j);
super.toStringBuf(buf); j.add("entry", _entry);
buf.append(", entry=", _entry);
} }
override public function writeObject (out :ObjectOutputStream) :void override public function writeObject (out :ObjectOutputStream) :void
@@ -25,7 +25,7 @@ import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream; import com.threerings.io.ObjectOutputStream;
import com.threerings.io.TypedArray; import com.threerings.io.TypedArray;
import com.threerings.util.StringBuilder; import com.threerings.util.Joiner;
/** /**
* Used to dispatch an invocation notification from the server to a * Used to dispatch an invocation notification from the server to a
@@ -103,13 +103,10 @@ public class InvocationNotificationEvent extends DEvent
} }
// documentation inherited // documentation inherited
override protected function toStringBuf (buf :StringBuilder) :void override protected function toStringJoiner (j :Joiner) :void
{ {
buf.append("INOT:"); super.toStringJoiner(j);
super.toStringBuf(buf); j.add("rcvId", _receiverId, "methodId", _methodId, "args", _args);
buf.append(", rcvId=", _receiverId);
buf.append(", methodId=", _methodId);
buf.append(", args=", _args);
} }
// documentation inherited // documentation inherited
@@ -24,7 +24,7 @@ package com.threerings.presents.dobj {
import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream; import com.threerings.io.ObjectOutputStream;
import com.threerings.util.StringBuilder; import com.threerings.util.Joiner;
/** /**
* Used to dispatch an invocation request from the client to the server. * Used to dispatch an invocation request from the client to the server.
@@ -99,13 +99,10 @@ public class InvocationRequestEvent extends DEvent
} }
// documentation inherited // documentation inherited
override protected function toStringBuf (buf :StringBuilder) :void override protected function toStringJoiner (j :Joiner) :void
{ {
buf.append("IREQ:"); super.toStringJoiner(j);
super.toStringBuf(buf); j.add("code", _invCode, "methodId", _methodId, "args", _args);
buf.append(", code=", _invCode);
buf.append(", methodId=", _methodId);
buf.append(", args=", _args);
} }
// documentation inherited from interface Streamable // documentation inherited from interface Streamable
@@ -24,7 +24,7 @@ package com.threerings.presents.dobj {
import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream; import com.threerings.io.ObjectOutputStream;
import com.threerings.util.StringBuilder; import com.threerings.util.Joiner;
/** /**
* Used to dispatch an invocation response from the server to the client. * Used to dispatch an invocation response from the server to the client.
@@ -99,13 +99,10 @@ public class InvocationResponseEvent extends DEvent
} }
// documentation inherited // documentation inherited
override protected function toStringBuf (buf :StringBuilder) :void override protected function toStringJoiner (j :Joiner) :void
{ {
buf.append("IRSP:"); super.toStringJoiner(j);
super.toStringBuf(buf); j.add("reqId", _requestId, "methodId", _methodId, "args", _args);
buf.append(", reqid=", _requestId);
buf.append(", methodId=", _methodId);
buf.append(", args=", _args);
} }
// documentation inherited // documentation inherited
@@ -26,7 +26,7 @@ import com.threerings.io.ObjectOutputStream;
import com.threerings.io.TypedArray; import com.threerings.io.TypedArray;
import com.threerings.util.Boxed; import com.threerings.util.Boxed;
import com.threerings.util.StringBuilder; import com.threerings.util.Joiner;
/** /**
* A message event is used to dispatch a message to all subscribers of a * A message event is used to dispatch a message to all subscribers of a
@@ -97,11 +97,10 @@ public class MessageEvent extends NamedEvent
} }
// documentation inherited // documentation inherited
override protected function toStringBuf (buf :StringBuilder) :void override protected function toStringJoiner (j :Joiner) :void
{ {
buf.append("MSG:"); super.toStringJoiner(j);
super.toStringBuf(buf); j.add("args", _args);
buf.append(", args=", _args);
} }
// documentation inherited // documentation inherited
@@ -21,7 +21,7 @@
package com.threerings.presents.dobj { package com.threerings.presents.dobj {
import com.threerings.util.StringBuilder; import com.threerings.util.Joiner;
import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream; import com.threerings.io.ObjectOutputStream;
@@ -53,10 +53,10 @@ public /* abstract */ class NamedEvent extends DEvent
return _name; return _name;
} }
override protected function toStringBuf (buf :StringBuilder) :void override protected function toStringJoiner (j :Joiner) :void
{ {
super.toStringBuf(buf); super.toStringJoiner(j);
buf.append(", name=", _name); j.add("name", _name);
} }
override public function writeObject (out :ObjectOutputStream) :void override public function writeObject (out :ObjectOutputStream) :void
@@ -24,7 +24,7 @@ package com.threerings.presents.dobj {
import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream; import com.threerings.io.ObjectOutputStream;
import com.threerings.util.StringBuilder; import com.threerings.util.Joiner;
/** /**
* An object added event is dispatched when an object is added to an * An object added event is dispatched when an object is added to an
@@ -97,11 +97,10 @@ public class ObjectAddedEvent extends NamedEvent
} }
// documentation inherited // documentation inherited
override protected function toStringBuf (buf :StringBuilder) :void override protected function toStringJoiner (j :Joiner) :void
{ {
buf.append("OBJADD:"); super.toStringJoiner(j);
super.toStringBuf(buf); j.add("oid", _oid);
buf.append(", oid=", _oid);
} }
protected var _oid :int; protected var _oid :int;
@@ -21,8 +21,6 @@
package com.threerings.presents.dobj { package com.threerings.presents.dobj {
import com.threerings.util.StringBuilder;
/** /**
* An object destroyed event is dispatched when an object has been removed * An object destroyed event is dispatched when an object has been removed
* from the distributed object system. It can also be constructed to * from the distributed object system. It can also be constructed to
@@ -59,12 +57,5 @@ public class ObjectDestroyedEvent extends DEvent
listener.objectDestroyed(this); listener.objectDestroyed(this);
} }
} }
// documentation inherited
override protected function toStringBuf (buf :StringBuilder) :void
{
buf.append("DESTROY:");
super.toStringBuf(buf);
}
} }
} }
@@ -21,7 +21,7 @@
package com.threerings.presents.dobj { package com.threerings.presents.dobj {
import com.threerings.util.StringBuilder; import com.threerings.util.Joiner;
import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream; import com.threerings.io.ObjectOutputStream;
@@ -99,11 +99,10 @@ public class ObjectRemovedEvent extends NamedEvent
} }
// documentation inherited // documentation inherited
override protected function toStringBuf (buf :StringBuilder) :void override protected function toStringJoiner (j :Joiner) :void
{ {
buf.append("OBJREM:"); super.toStringJoiner(j);
super.toStringBuf(buf); j.add("oid", _oid);
buf.append(", oid=", _oid);
} }
protected var _oid :int; protected var _oid :int;
@@ -29,8 +29,6 @@ import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream; import com.threerings.io.ObjectOutputStream;
import com.threerings.io.TypedArray; import com.threerings.io.TypedArray;
import com.threerings.util.StringBuilder;
/** /**
* An oid list is used to store lists of object ids. The list will not * An oid list is used to store lists of object ids. The list will not
* allow duplicate ids. This class is not synchronized, with the * allow duplicate ids. This class is not synchronized, with the
@@ -127,11 +125,7 @@ public class OidList
public function toString () :String public function toString () :String
{ {
var buf :StringBuilder = new StringBuilder(); return "{" + _oids.toString() + "}";
buf.append("{");
buf.append(_oids.toString());
buf.append("}");
return buf.toString();
} }
private var _oids :TypedArray; private var _oids :TypedArray;
@@ -23,67 +23,19 @@ package com.threerings.presents.net {
import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream; import com.threerings.io.ObjectOutputStream;
import com.threerings.io.Streamable; import com.threerings.io.SimpleStreamableObject;
public /* abstract */ class Credentials public /* abstract */ class Credentials extends SimpleStreamableObject
implements Streamable
{ {
public function Credentials () public function Credentials ()
{ {
} }
// from interface Streamable // from interface Streamable
public function writeObject (out :ObjectOutputStream) :void override public function readObject (ins :ObjectInputStream) :void
//throws IOError
{
// nada
}
// from interface Streamable
public function readObject (ins :ObjectInputStream) :void
//throws IOError //throws IOError
{ {
throw new Error(); // we never read Creds on the client throw new Error(); // we never read Creds on the client
} }
/*
// main
public function toString (joiner :Joiner = null) :String
{
if (joiner == null) {
return toString(new Joiner("ClassName"));
}
return joiner.add("baz", bit, "count", 33).toString();
}
// subclass
override public function toString (joiner :Joiner = null) :String
{
if (joiner != null) {
joiner.add("foo", bar);
}
return super.toString(joiner);
}
// -----
public function toString () :String
{
return join(new Joiner(this)).toString();
}
protected function join (joiner :Joiner) :Joiner
{
return joiner.add(
"baz", bit, "count", 33);
}
override protected join (joiner :Joiner) :Joiner
{
return super.join(joiner).add(
"foo", bar);
}
*/
} }
} }
@@ -26,6 +26,8 @@ import com.adobe.crypto.MD5;
import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream; import com.threerings.io.ObjectOutputStream;
import com.threerings.util.Joiner;
/** /**
* Extends the basic credentials to provide bureau-specific fields. * Extends the basic credentials to provide bureau-specific fields.
*/ */
@@ -60,9 +62,10 @@ public class ServiceCreds extends Credentials
} }
// from Object // from Object
public function toString () :String override protected function toStringJoiner (j :Joiner) :void
{ {
return "[id=" + clientId + ", token=" + _authToken + "]"; super.toStringJoiner(j);
j.add("token", _authToken);
} }
/** /**
@@ -21,8 +21,8 @@
package com.threerings.presents.net { package com.threerings.presents.net {
import com.threerings.util.Joiner;
import com.threerings.util.Name; import com.threerings.util.Name;
import com.threerings.util.StringBuilder;
import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream; import com.threerings.io.ObjectOutputStream;
@@ -55,26 +55,10 @@ public class UsernamePasswordCreds extends Credentials
out.writeField(_password); out.writeField(_password);
} }
// from Credentials override protected function toStringJoiner (j :Joiner) :void
override public function readObject (ins :ObjectInputStream) :void
{ {
_username = Name(ins.readObject()); j.add("username", _username, "password", _password);
_password = (ins.readField(String) as String); super.toStringJoiner(j);
}
// from Object
public function toString () :String
{
var buf :StringBuilder = new StringBuilder("[");
toStringBuf(buf);
buf.append("]");
return buf.toString();
}
protected function toStringBuf (buf :StringBuilder) :void
{
buf.append("username=", _username);
buf.append(", password=", _password);
} }
protected var _username :Name; protected var _username :Name;
+10 -12
View File
@@ -302,25 +302,24 @@ public class MessageBundle
{ {
args = Util.unfuckVarargs(args); args = Util.unfuckVarargs(args);
var buf :StringBuilder = new StringBuilder(); var s :String = key + "|";
buf.append(key, "|");
for (var ii :int = 0; ii < args.length; ii++) { for (var ii :int = 0; ii < args.length; ii++) {
if (ii > 0) { if (ii > 0) {
buf.append("|"); s += "|";
} }
var arg :String = String(args[ii]); var arg :String = String(args[ii]);
for (var p :int = 0; p < arg.length; p++) { for (var p :int = 0; p < arg.length; p++) {
var ch :String = arg.charAt(p); var ch :String = arg.charAt(p);
if (ch == "|") { if (ch == "|") {
buf.append("\\!"); s += "\\!";
} else if (ch == "\\") { } else if (ch == "\\") {
buf.append("\\\\"); s += "\\\\";
} else { } else {
buf.append(ch); s += ch;
} }
} }
} }
return buf.toString(); return s;
} }
/** /**
@@ -404,19 +403,18 @@ public class MessageBundle
return val; return val;
} }
var buf :StringBuilder = new StringBuilder(); var s :String = "";
for (var ii :int = 0; ii < val.length; ii++) { for (var ii :int = 0; ii < val.length; ii++) {
var ch :String = val.charAt(ii); var ch :String = val.charAt(ii);
if (ch != "\\" || ii == val.length-1) { if (ch != "\\" || ii == val.length-1) {
buf.append(ch); s += ch;
} else { } else {
// look at the next character // look at the next character
ch = val.charAt(++ii); ch = val.charAt(++ii);
buf.append((ch == "!") ? "|" : ch); s += (ch == "!") ? "|" : ch;
} }
} }
return s;
return buf.toString();
} }
/** The message manager via whom we'll resolve fully qualified /** The message manager via whom we'll resolve fully qualified