X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fcom%2Fdogcows%2FUtil.java;h=51dd3f50261880c4ca536493361a1efccc7d798c;hb=ceb85143679bd2fdc5d39e354c440a329dbc9a2b;hp=40303b6b7aac26dfa5854b9ce1dc7d032bf08eb1;hpb=13cdace1459b932489b8b43885504d701643f1bd;p=chaz%2Fvimcoder diff --git a/src/com/dogcows/Util.java b/src/com/dogcows/Util.java index 40303b6..51dd3f5 100644 --- a/src/com/dogcows/Util.java +++ b/src/com/dogcows/Util.java @@ -61,12 +61,12 @@ public abstract class Util } /** - * Quote a string by replacing prepending backslashes and double + * Escape a string by replacing prepending backslashes and double * quotation characters with an extra backslash. - * @param The string to be quoted. - * @return The quoted string. + * @param The string to be escaped. + * @return The escaped string. */ - public static String quote(String a) + public static String escape(String a) { a = a.replaceAll("\\\\", "\\\\\\\\"); a = a.replaceAll("\"", "\\\\\\\""); @@ -104,7 +104,7 @@ public abstract class Util /** * Read a resource file into a string object. * The resources should be placed in the directory `resources' - * underneath the parent directory of this class. Reading resources + * underneath the parent directory of this class. Reading resources * packaged in a jar is allowable. * @param path Relative path to the resource. * @return The contents of the resource. @@ -120,7 +120,7 @@ public abstract class Util try { byte[] buffer = new byte[4096]; - int numBytes = 0; + int numBytes = 0; while (0 < (numBytes = stream.read(buffer))) { text.append(new String(buffer, 0, numBytes)); @@ -151,10 +151,10 @@ public abstract class Util String text = template; for (String key : terms.keySet()) { - text = text.replaceAll("\\$" + key + "\\$", - Util.quote(terms.get(key))); + text = text.replaceAll("\\$" + key + "\\$", Util.escape(terms.get(key))); } return text; } } +// vim:noet:ts=8