KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thaiopensource > relaxng > impl > StringNormalizer


1 package com.thaiopensource.relaxng.impl;
2
3 import java.util.StringTokenizer JavaDoc;
4
5 class StringNormalizer {
6   static String JavaDoc normalize(String JavaDoc s) {
7     StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
8     for (StringTokenizer JavaDoc e = new StringTokenizer JavaDoc(s); e.hasMoreElements();) {
9       if (buf.length() > 0)
10     buf.append(' ');
11       buf.append((String JavaDoc)e.nextElement());
12     }
13     return buf.toString();
14   }
15 }
16
Popular Tags