public static string format(string msg, params object[] args)
{
if(args == null || args.Length == 0 || msg == null) {
return msg;
}
else {
StringBuilder sb = new StringBuilder(msg.Length + args.Length * 10);
for(int current = 0, argIndex = 0; current < msg.Length;) {
int token = msg.IndexOf(PLACE_HOLDER, current);
if(token > -1) {
sb.Append(msg.Substring(current, token - current));
sb.Append(args[argIndex ++]);
current = token + PLACE_HOLDER.Length;
}
else {
sb.Append(msg.Substring(current));
break;
}
}
return sb.ToString();
}
}