1 16 19 package org.apache.xml.utils; 20 21 26 public class XMLCharacterRecognizer 27 { 28 29 36 public static boolean isWhiteSpace(char ch) 37 { 38 return (ch == 0x20) || (ch == 0x09) || (ch == 0xD) || (ch == 0xA); 39 } 40 41 50 public static boolean isWhiteSpace(char ch[], int start, int length) 51 { 52 53 int end = start + length; 54 55 for (int s = start; s < end; s++) 56 { 57 if (!isWhiteSpace(ch[s])) 58 return false; 59 } 60 61 return true; 62 } 63 64 70 public static boolean isWhiteSpace(StringBuffer buf) 71 { 72 73 int n = buf.length(); 74 75 for (int i = 0; i < n; i++) 76 { 77 if (!isWhiteSpace(buf.charAt(i))) 78 return false; 79 } 80 81 return true; 82 } 83 84 90 public static boolean isWhiteSpace(String s) 91 { 92 93 if(null != s) 94 { 95 int n = s.length(); 96 97 for (int i = 0; i < n; i++) 98 { 99 if (!isWhiteSpace(s.charAt(i))) 100 return false; 101 } 102 } 103 104 return true; 105 } 106 107 } 108 | Popular Tags |