Revision: 7054
Author: victormote
Date: 2006-04-18 16:39:08 -0700 (Tue, 18 Apr 2006)
ViewCVS: http://svn.sourceforge.net/foray/?rev=7054&view=rev
Log Message:
-----------
Use new standard Common method.
Modified Paths:
--------------
trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java
Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java
===================================================================
--- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2006-04-18 23:38:34 UTC (rev 7053)
+++ trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2006-04-18 23:39:08 UTC (rev 7054)
@@ -24,6 +24,7 @@
package org.foray.pretty;
+import org.foray.common.StringUtil;
import org.foray.pretty.dtd.DTD;
import org.foray.pretty.dtd.DTDElement;
import org.foray.pretty.dtd.ElementStack;
@@ -402,29 +403,13 @@
private void normalizeWhitespace() {
/* Convert all line-feeds to spaces. */
- convertString(this.charBuffer, "\n", " ");
+ StringUtil.replace(this.charBuffer, "\n", " ");
/* Convert all tabs to spaces. */
- convertString(this.charBuffer, "\t", " ");
+ StringUtil.replace(this.charBuffer, "\t", " ");
/* Remove extra spaces. */
- convertString(this.charBuffer, " ", " ");
+ StringUtil.replace(this.charBuffer, " ", " ");
}
- /**
- * Replaces all occurrences of a given String with a different Strings.
- */
- private static void convertString(StringBuffer buffer, String oldString,
- String newString) {
- boolean anyChanges = true;
- while (anyChanges) {
- anyChanges = false;
- int index = buffer.indexOf(oldString);
- if (index > -1) {
- buffer.replace(index, index + oldString.length(), newString);
- anyChanges = true;
- }
- }
- }
-
private void addToQueue(String string) {
if (string == null) {
return;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|