1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2 <!--NewPage--> 3 <HTML> 4 <HEAD> 5 <!-- Generated by javadoc (build 1.6.0-google-internal) on Mon Jan 04 20:47:56 PST 2010 --> 6 <TITLE> 7 CharMatcher (Guava Libraries 2010.01.04) 8 </TITLE> 9 10 <META NAME="date" CONTENT="2010-01-04"> 11 12 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> 13 14 <SCRIPT type="text/javascript"> 15 function windowTitle() 16 { 17 if (location.href.indexOf('is-external=true') == -1) { 18 parent.document.title="CharMatcher (Guava Libraries 2010.01.04)"; 19 } 20 } 21 </SCRIPT> 22 <NOSCRIPT> 23 </NOSCRIPT> 24 25 </HEAD> 26 27 <BODY BGCOLOR="white" onload="windowTitle();"> 28 <HR> 29 30 31 <!-- ========= START OF TOP NAVBAR ======= --> 32 <A NAME="navbar_top"><!-- --></A> 33 <A HREF="#skip-navbar_top" title="Skip navigation links"></A> 34 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 35 <TR> 36 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 37 <A NAME="navbar_top_firstrow"><!-- --></A> 38 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 39 <TR ALIGN="center" VALIGN="top"> 40 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 42 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/CharMatcher.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 44 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 45 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 46 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 47 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 48 </TR> 49 </TABLE> 50 </TD> 51 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 52 </EM> 53 </TD> 54 </TR> 55 56 <TR> 57 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 58 <A HREF="../../../../com/google/common/base/CaseFormat.html" title="enum in com.google.common.base"><B>PREV CLASS</B></A> 59 <A HREF="../../../../com/google/common/base/CharMatcher.LookupTable.html" title="class in com.google.common.base"><B>NEXT CLASS</B></A></FONT></TD> 60 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 61 <A HREF="../../../../index.html?com/google/common/base/CharMatcher.html" target="_top"><B>FRAMES</B></A> 62 <A HREF="CharMatcher.html" target="_top"><B>NO FRAMES</B></A> 63 <SCRIPT type="text/javascript"> 64 <!-- 65 if(window==top) { 66 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); 67 } 68 //--> 69 </SCRIPT> 70 <NOSCRIPT> 71 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> 72 </NOSCRIPT> 73 74 75 </FONT></TD> 76 </TR> 77 <TR> 78 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 79 SUMMARY: <A HREF="#nested_class_summary">NESTED</A> | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> 80 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 81 DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> 82 </TR> 83 </TABLE> 84 <A NAME="skip-navbar_top"></A> 85 <!-- ========= END OF TOP NAVBAR ========= --> 86 87 <HR> 88 <!-- ======== START OF CLASS DATA ======== --> 89 <H2> 90 <FONT SIZE="-1"> 91 com.google.common.base</FONT> 92 <BR> 93 Class CharMatcher</H2> 94 <PRE> 95 <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A> 96 <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.google.common.base.CharMatcher</B> 97 </PRE> 98 <DL> 99 <DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Character.html?is-external=true" title="class or interface in java.lang">Character</A>></DD> 100 </DL> 101 <HR> 102 <DL> 103 <DT><PRE>public abstract class <B>CharMatcher</B><DT>extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A><DT>implements <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Character.html?is-external=true" title="class or interface in java.lang">Character</A>></DL> 104 </PRE> 105 106 <P> 107 Determines a true or false value for any Java <code>char</code> value, just as 108 <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base"><CODE>Predicate</CODE></A> does for any <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang"><CODE>Object</CODE></A>. Also offers basic text 109 processing methods based on this function. Implementations are strongly 110 encouraged to be side-effect-free and immutable. 111 112 <p>Throughout the documentation of this class, the phrase "matching 113 character" is used to mean "any character <code>c</code> for which <code>this.matches(c)</code> returns <code>true</code>". 114 115 <p><b>Note:</b> This class deals only with <code>char</code> values; it does not 116 understand supplementary Unicode code points in the range <code>0x10000</code> to 117 <code>0x10FFFF</code>. Such logical characters are encoded into a <code>String</code> 118 using surrogate pairs, and a <code>CharMatcher</code> treats these just as two 119 separate characters. 120 <P> 121 122 <P> 123 <DL> 124 <DT><B>Since:</B></DT> 125 <DD>2009.09.15 <b>tentative</b></DD> 126 <DT><B>Author:</B></DT> 127 <DD>Kevin Bourrillion</DD> 128 </DL> 129 <HR> 130 131 <P> 132 <!-- ======== NESTED CLASS SUMMARY ======== --> 133 134 <A NAME="nested_class_summary"><!-- --></A> 135 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 136 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 137 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 138 <B>Nested Class Summary</B></FONT></TH> 139 </TR> 140 <TR BGCOLOR="white" CLASS="TableRowColor"> 141 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 142 <CODE>protected static class</CODE></FONT></TD> 143 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.LookupTable.html" title="class in com.google.common.base">CharMatcher.LookupTable</A></B></CODE> 144 145 <BR> 146 A bit array with one bit per <code>char</code> value, used by <A HREF="../../../../com/google/common/base/CharMatcher.html#precomputed()"><CODE>precomputed()</CODE></A>.</TD> 147 </TR> 148 </TABLE> 149 <!-- =========== FIELD SUMMARY =========== --> 150 151 <A NAME="field_summary"><!-- --></A> 152 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 153 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 154 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 155 <B>Field Summary</B></FONT></TH> 156 </TR> 157 <TR BGCOLOR="white" CLASS="TableRowColor"> 158 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 159 <CODE>static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 160 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#ANY">ANY</A></B></CODE> 161 162 <BR> 163 Matches any character.</TD> 164 </TR> 165 <TR BGCOLOR="white" CLASS="TableRowColor"> 166 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 167 <CODE>static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 168 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#ASCII">ASCII</A></B></CODE> 169 170 <BR> 171 Determines whether a character is ASCII, meaning that its code point is 172 less than 128.</TD> 173 </TR> 174 <TR BGCOLOR="white" CLASS="TableRowColor"> 175 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 176 <CODE>static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 177 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#BREAKING_WHITESPACE">BREAKING_WHITESPACE</A></B></CODE> 178 179 <BR> 180 Determines whether a character is a breaking whitespace (that is, 181 a whitespace which can be interpreted as a break between words 182 for formatting purposes).</TD> 183 </TR> 184 <TR BGCOLOR="white" CLASS="TableRowColor"> 185 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 186 <CODE>static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 187 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#DIGIT">DIGIT</A></B></CODE> 188 189 <BR> 190 Determines whether a character is a digit according to 191 <a href="http://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5Cp%7Bdigit%7D">Unicode</a>.</TD> 192 </TR> 193 <TR BGCOLOR="white" CLASS="TableRowColor"> 194 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 195 <CODE>static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 196 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#INVISIBLE">INVISIBLE</A></B></CODE> 197 198 <BR> 199 Determines whether a character is invisible; that is, if its Unicode 200 category is any of SPACE_SEPARATOR, LINE_SEPARATOR, 201 PARAGRAPH_SEPARATOR, CONTROL, FORMAT, SURROGATE, and PRIVATE_USE according 202 to ICU4J.</TD> 203 </TR> 204 <TR BGCOLOR="white" CLASS="TableRowColor"> 205 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 206 <CODE>static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 207 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#JAVA_DIGIT">JAVA_DIGIT</A></B></CODE> 208 209 <BR> 210 Determines whether a character is a digit according to <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Character.html?is-external=true#isDigit(char)" title="class or interface in java.lang"><CODE>Java's definition</CODE></A>.</TD> 211 </TR> 212 <TR BGCOLOR="white" CLASS="TableRowColor"> 213 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 214 <CODE>static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 215 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#JAVA_ISO_CONTROL">JAVA_ISO_CONTROL</A></B></CODE> 216 217 <BR> 218 Determines whether a character is an ISO control character according to 219 <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Character.html?is-external=true#isISOControl(char)" title="class or interface in java.lang"><CODE>Character.isISOControl(char)</CODE></A>.</TD> 220 </TR> 221 <TR BGCOLOR="white" CLASS="TableRowColor"> 222 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 223 <CODE>static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 224 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#JAVA_LETTER">JAVA_LETTER</A></B></CODE> 225 226 <BR> 227 Determines whether a character is a letter according to <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Character.html?is-external=true#isLetter(char)" title="class or interface in java.lang"><CODE>Java's definition</CODE></A>.</TD> 228 </TR> 229 <TR BGCOLOR="white" CLASS="TableRowColor"> 230 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 231 <CODE>static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 232 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#JAVA_LETTER_OR_DIGIT">JAVA_LETTER_OR_DIGIT</A></B></CODE> 233 234 <BR> 235 Determines whether a character is a letter or digit according to <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Character.html?is-external=true#isLetterOrDigit(char)" title="class or interface in java.lang"><CODE>Java's definition</CODE></A>.</TD> 236 </TR> 237 <TR BGCOLOR="white" CLASS="TableRowColor"> 238 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 239 <CODE>static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 240 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#JAVA_LOWER_CASE">JAVA_LOWER_CASE</A></B></CODE> 241 242 <BR> 243 Determines whether a character is lower case according to <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Character.html?is-external=true#isLowerCase(char)" title="class or interface in java.lang"><CODE>Java's definition</CODE></A>.</TD> 244 </TR> 245 <TR BGCOLOR="white" CLASS="TableRowColor"> 246 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 247 <CODE>static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 248 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#JAVA_UPPER_CASE">JAVA_UPPER_CASE</A></B></CODE> 249 250 <BR> 251 Determines whether a character is upper case according to <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Character.html?is-external=true#isUpperCase(char)" title="class or interface in java.lang"><CODE>Java's definition</CODE></A>.</TD> 252 </TR> 253 <TR BGCOLOR="white" CLASS="TableRowColor"> 254 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 255 <CODE>static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 256 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#JAVA_WHITESPACE">JAVA_WHITESPACE</A></B></CODE> 257 258 <BR> 259 Determines whether a character is whitespace according to <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Character.html?is-external=true#isWhitespace(char)" title="class or interface in java.lang"><CODE>Java's definition</CODE></A>; it is usually preferable 260 to use <A HREF="../../../../com/google/common/base/CharMatcher.html#WHITESPACE"><CODE>WHITESPACE</CODE></A>.</TD> 261 </TR> 262 <TR BGCOLOR="white" CLASS="TableRowColor"> 263 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 264 <CODE>static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 265 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#NONE">NONE</A></B></CODE> 266 267 <BR> 268 Matches no characters.</TD> 269 </TR> 270 <TR BGCOLOR="white" CLASS="TableRowColor"> 271 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 272 <CODE>static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 273 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#SINGLE_WIDTH">SINGLE_WIDTH</A></B></CODE> 274 275 <BR> 276 Determines whether a character is single-width (not double-width).</TD> 277 </TR> 278 <TR BGCOLOR="white" CLASS="TableRowColor"> 279 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 280 <CODE>static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 281 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#WHITESPACE">WHITESPACE</A></B></CODE> 282 283 <BR> 284 Determines whether a character is whitespace according to the latest 285 Unicode standard, as illustrated 286 <a href="http://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5Cp%7Bwhitespace%7D">here</a>.</TD> 287 </TR> 288 </TABLE> 289 290 <!-- ======== CONSTRUCTOR SUMMARY ======== --> 291 292 <A NAME="constructor_summary"><!-- --></A> 293 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 294 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 295 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 296 <B>Constructor Summary</B></FONT></TH> 297 </TR> 298 <TR BGCOLOR="white" CLASS="TableRowColor"> 299 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#CharMatcher()">CharMatcher</A></B>()</CODE> 300 301 <BR> 302 </TD> 303 </TR> 304 </TABLE> 305 306 <!-- ========== METHOD SUMMARY =========== --> 307 308 <A NAME="method_summary"><!-- --></A> 309 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 310 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 311 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 312 <B>Method Summary</B></FONT></TH> 313 </TR> 314 <TR BGCOLOR="white" CLASS="TableRowColor"> 315 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 316 <CODE> <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 317 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#and(com.google.common.base.CharMatcher)">and</A></B>(<A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> other)</CODE> 318 319 <BR> 320 Returns a matcher that matches any character matched by both this matcher 321 and <code>other</code>.</TD> 322 </TR> 323 <TR BGCOLOR="white" CLASS="TableRowColor"> 324 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 325 <CODE>static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 326 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#anyOf(java.lang.CharSequence)">anyOf</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence)</CODE> 327 328 <BR> 329 Returns a <code>char</code> matcher that matches any character present in the 330 given character sequence.</TD> 331 </TR> 332 <TR BGCOLOR="white" CLASS="TableRowColor"> 333 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 334 <CODE> boolean</CODE></FONT></TD> 335 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#apply(java.lang.Character)">apply</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Character.html?is-external=true" title="class or interface in java.lang">Character</A> character)</CODE> 336 337 <BR> 338 Returns <code>true</code> if this matcher matches the given character.</TD> 339 </TR> 340 <TR BGCOLOR="white" CLASS="TableRowColor"> 341 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 342 <CODE> <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD> 343 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#collapseFrom(java.lang.CharSequence, char)">collapseFrom</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence, 344 char replacement)</CODE> 345 346 <BR> 347 Returns a string copy of the input character sequence, with each group of 348 consecutive characters that match this matcher replaced by a single 349 replacement character.</TD> 350 </TR> 351 <TR BGCOLOR="white" CLASS="TableRowColor"> 352 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 353 <CODE> int</CODE></FONT></TD> 354 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#countIn(java.lang.CharSequence)">countIn</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence)</CODE> 355 356 <BR> 357 Returns the number of matching characters found in a character sequence.</TD> 358 </TR> 359 <TR BGCOLOR="white" CLASS="TableRowColor"> 360 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 361 <CODE>static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 362 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#forPredicate(com.google.common.base.Predicate)">forPredicate</A></B>(<A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Character.html?is-external=true" title="class or interface in java.lang">Character</A>> predicate)</CODE> 363 364 <BR> 365 Returns a matcher with identical behavior to the given <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Character.html?is-external=true" title="class or interface in java.lang"><CODE>Character</CODE></A>-based predicate, but which operates on primitive <code>char</code> 366 instances instead.</TD> 367 </TR> 368 <TR BGCOLOR="white" CLASS="TableRowColor"> 369 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 370 <CODE> int</CODE></FONT></TD> 371 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#indexIn(java.lang.CharSequence)">indexIn</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence)</CODE> 372 373 <BR> 374 Returns the index of the first matching character in a character sequence, 375 or <code>-1</code> if no matching character is present.</TD> 376 </TR> 377 <TR BGCOLOR="white" CLASS="TableRowColor"> 378 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 379 <CODE> int</CODE></FONT></TD> 380 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#indexIn(java.lang.CharSequence, int)">indexIn</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence, 381 int start)</CODE> 382 383 <BR> 384 Returns the index of the first matching character in a character sequence, 385 starting from a given position, or <code>-1</code> if no character matches after 386 that position.</TD> 387 </TR> 388 <TR BGCOLOR="white" CLASS="TableRowColor"> 389 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 390 <CODE>static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 391 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#inRange(char, char)">inRange</A></B>(char startInclusive, 392 char endInclusive)</CODE> 393 394 <BR> 395 Returns a <code>char</code> matcher that matches any character in a given range 396 (both endpoints are inclusive).</TD> 397 </TR> 398 <TR BGCOLOR="white" CLASS="TableRowColor"> 399 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 400 <CODE>static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 401 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#is(char)">is</A></B>(char match)</CODE> 402 403 <BR> 404 Returns a <code>char</code> matcher that matches only one specified character.</TD> 405 </TR> 406 <TR BGCOLOR="white" CLASS="TableRowColor"> 407 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 408 <CODE>static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 409 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#isNot(char)">isNot</A></B>(char match)</CODE> 410 411 <BR> 412 Returns a <code>char</code> matcher that matches any character except the one 413 specified.</TD> 414 </TR> 415 <TR BGCOLOR="white" CLASS="TableRowColor"> 416 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 417 <CODE> int</CODE></FONT></TD> 418 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#lastIndexIn(java.lang.CharSequence)">lastIndexIn</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence)</CODE> 419 420 <BR> 421 Returns the index of the last matching character in a character sequence, 422 or <code>-1</code> if no matching character is present.</TD> 423 </TR> 424 <TR BGCOLOR="white" CLASS="TableRowColor"> 425 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 426 <CODE>abstract boolean</CODE></FONT></TD> 427 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#matches(char)">matches</A></B>(char c)</CODE> 428 429 <BR> 430 Determines a true or false value for the given character.</TD> 431 </TR> 432 <TR BGCOLOR="white" CLASS="TableRowColor"> 433 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 434 <CODE> boolean</CODE></FONT></TD> 435 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#matchesAllOf(java.lang.CharSequence)">matchesAllOf</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence)</CODE> 436 437 <BR> 438 Returns <code>true</code> if a character sequence contains only matching 439 characters.</TD> 440 </TR> 441 <TR BGCOLOR="white" CLASS="TableRowColor"> 442 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 443 <CODE> boolean</CODE></FONT></TD> 444 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#matchesNoneOf(java.lang.CharSequence)">matchesNoneOf</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence)</CODE> 445 446 <BR> 447 Returns <code>true</code> if a character sequence contains no matching 448 characters.</TD> 449 </TR> 450 <TR BGCOLOR="white" CLASS="TableRowColor"> 451 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 452 <CODE> <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 453 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#negate()">negate</A></B>()</CODE> 454 455 <BR> 456 Returns a matcher that matches any character not matched by this matcher.</TD> 457 </TR> 458 <TR BGCOLOR="white" CLASS="TableRowColor"> 459 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 460 <CODE>static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 461 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#noneOf(java.lang.CharSequence)">noneOf</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence)</CODE> 462 463 <BR> 464 Returns a <code>char</code> matcher that matches any character not present in 465 the given character sequence.</TD> 466 </TR> 467 <TR BGCOLOR="white" CLASS="TableRowColor"> 468 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 469 <CODE> <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 470 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#or(com.google.common.base.CharMatcher)">or</A></B>(<A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> other)</CODE> 471 472 <BR> 473 Returns a matcher that matches any character matched by either this matcher 474 or <code>other</code>.</TD> 475 </TR> 476 <TR BGCOLOR="white" CLASS="TableRowColor"> 477 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 478 <CODE> <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A></CODE></FONT></TD> 479 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#precomputed()">precomputed</A></B>()</CODE> 480 481 <BR> 482 Returns a <code>char</code> matcher functionally equivalent to this one, but 483 which may be faster to query than the original; your mileage may vary.</TD> 484 </TR> 485 <TR BGCOLOR="white" CLASS="TableRowColor"> 486 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 487 <CODE> <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD> 488 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#removeFrom(java.lang.CharSequence)">removeFrom</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence)</CODE> 489 490 <BR> 491 Returns a string containing all non-matching characters of a character 492 sequence, in order.</TD> 493 </TR> 494 <TR BGCOLOR="white" CLASS="TableRowColor"> 495 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 496 <CODE> <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD> 497 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#replaceFrom(java.lang.CharSequence, char)">replaceFrom</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence, 498 char replacement)</CODE> 499 500 <BR> 501 Returns a string copy of the input character sequence, with each character 502 that matches this matcher replaced by a given replacement character.</TD> 503 </TR> 504 <TR BGCOLOR="white" CLASS="TableRowColor"> 505 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 506 <CODE> <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD> 507 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#replaceFrom(java.lang.CharSequence, java.lang.CharSequence)">replaceFrom</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence, 508 <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> replacement)</CODE> 509 510 <BR> 511 Returns a string copy of the input character sequence, with each character 512 that matches this matcher replaced by a given replacement sequence.</TD> 513 </TR> 514 <TR BGCOLOR="white" CLASS="TableRowColor"> 515 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 516 <CODE> <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD> 517 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#retainFrom(java.lang.CharSequence)">retainFrom</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence)</CODE> 518 519 <BR> 520 Returns a string containing all matching characters of a character 521 sequence, in order.</TD> 522 </TR> 523 <TR BGCOLOR="white" CLASS="TableRowColor"> 524 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 525 <CODE>protected void</CODE></FONT></TD> 526 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#setBits(com.google.common.base.CharMatcher.LookupTable)">setBits</A></B>(<A HREF="../../../../com/google/common/base/CharMatcher.LookupTable.html" title="class in com.google.common.base">CharMatcher.LookupTable</A> table)</CODE> 527 528 <BR> 529 For use by implementors; sets the bit corresponding to each character ('\0' 530 to '\uFFFF') that matches this matcher in the given bit array, 531 leaving all other bits untouched.</TD> 532 </TR> 533 <TR BGCOLOR="white" CLASS="TableRowColor"> 534 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 535 <CODE> <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD> 536 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#trimAndCollapseFrom(java.lang.CharSequence, char)">trimAndCollapseFrom</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence, 537 char replacement)</CODE> 538 539 <BR> 540 Collapses groups of matching characters exactly as <A HREF="../../../../com/google/common/base/CharMatcher.html#collapseFrom(java.lang.CharSequence, char)"><CODE>collapseFrom(java.lang.CharSequence, char)</CODE></A> 541 does, except that groups of matching characters at the start or end of the 542 sequence are removed without replacement.</TD> 543 </TR> 544 <TR BGCOLOR="white" CLASS="TableRowColor"> 545 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 546 <CODE> <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD> 547 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#trimFrom(java.lang.CharSequence)">trimFrom</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence)</CODE> 548 549 <BR> 550 Returns a substring of the input character sequence that omits all 551 characters this matcher matches from the beginning and from the end of the 552 string.</TD> 553 </TR> 554 <TR BGCOLOR="white" CLASS="TableRowColor"> 555 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 556 <CODE> <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD> 557 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#trimLeadingFrom(java.lang.CharSequence)">trimLeadingFrom</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence)</CODE> 558 559 <BR> 560 Returns a substring of the input character sequence that omits all 561 characters this matcher matches from the beginning of the 562 string.</TD> 563 </TR> 564 <TR BGCOLOR="white" CLASS="TableRowColor"> 565 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 566 <CODE> <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD> 567 <TD><CODE><B><A HREF="../../../../com/google/common/base/CharMatcher.html#trimTrailingFrom(java.lang.CharSequence)">trimTrailingFrom</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence)</CODE> 568 569 <BR> 570 Returns a substring of the input character sequence that omits all 571 characters this matcher matches from the end of the 572 string.</TD> 573 </TR> 574 </TABLE> 575 <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> 576 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 577 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> 578 <TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH> 579 </TR> 580 <TR BGCOLOR="white" CLASS="TableRowColor"> 581 <TD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD> 582 </TR> 583 </TABLE> 584 <A NAME="methods_inherited_from_class_com.google.common.base.Predicate"><!-- --></A> 585 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 586 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> 587 <TH ALIGN="left"><B>Methods inherited from interface com.google.common.base.<A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A></B></TH> 588 </TR> 589 <TR BGCOLOR="white" CLASS="TableRowColor"> 590 <TD><CODE><A HREF="../../../../com/google/common/base/Predicate.html#equals(java.lang.Object)">equals</A></CODE></TD> 591 </TR> 592 </TABLE> 593 594 <P> 595 596 <!-- ============ FIELD DETAIL =========== --> 597 598 <A NAME="field_detail"><!-- --></A> 599 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 600 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 601 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 602 <B>Field Detail</B></FONT></TH> 603 </TR> 604 </TABLE> 605 606 <A NAME="WHITESPACE"><!-- --></A><H3> 607 WHITESPACE</H3> 608 <PRE> 609 public static final <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>WHITESPACE</B></PRE> 610 <DL> 611 <DD>Determines whether a character is whitespace according to the latest 612 Unicode standard, as illustrated 613 <a href="http://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5Cp%7Bwhitespace%7D">here</a>. 614 This is not the same definition used by other Java APIs. See a comparison 615 of several definitions of "whitespace" at 616 <a href="TODO">(TODO)</a>. 617 618 <p><b>Note:</b> as the Unicode definition evolves, we will modify this 619 constant to keep it up to date. 620 <P> 621 <DL> 622 </DL> 623 </DL> 624 <HR> 625 626 <A NAME="BREAKING_WHITESPACE"><!-- --></A><H3> 627 BREAKING_WHITESPACE</H3> 628 <PRE> 629 public static final <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>BREAKING_WHITESPACE</B></PRE> 630 <DL> 631 <DD>Determines whether a character is a breaking whitespace (that is, 632 a whitespace which can be interpreted as a break between words 633 for formatting purposes). See <A HREF="../../../../com/google/common/base/CharMatcher.html#WHITESPACE"><CODE>WHITESPACE</CODE></A> for a discussion 634 of that term. 635 <P> 636 <DL> 637 <DT><B>Since:</B></DT> 638 <DD>2010.01.04 <b>tentative</b></DD> 639 </DL> 640 </DL> 641 <HR> 642 643 <A NAME="ASCII"><!-- --></A><H3> 644 ASCII</H3> 645 <PRE> 646 public static final <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>ASCII</B></PRE> 647 <DL> 648 <DD>Determines whether a character is ASCII, meaning that its code point is 649 less than 128. 650 <P> 651 <DL> 652 </DL> 653 </DL> 654 <HR> 655 656 <A NAME="DIGIT"><!-- --></A><H3> 657 DIGIT</H3> 658 <PRE> 659 public static final <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>DIGIT</B></PRE> 660 <DL> 661 <DD>Determines whether a character is a digit according to 662 <a href="http://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5Cp%7Bdigit%7D">Unicode</a>. 663 <P> 664 <DL> 665 </DL> 666 </DL> 667 <HR> 668 669 <A NAME="JAVA_WHITESPACE"><!-- --></A><H3> 670 JAVA_WHITESPACE</H3> 671 <PRE> 672 public static final <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>JAVA_WHITESPACE</B></PRE> 673 <DL> 674 <DD>Determines whether a character is whitespace according to <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Character.html?is-external=true#isWhitespace(char)" title="class or interface in java.lang"><CODE>Java's definition</CODE></A>; it is usually preferable 675 to use <A HREF="../../../../com/google/common/base/CharMatcher.html#WHITESPACE"><CODE>WHITESPACE</CODE></A>. See a comparison of several definitions of 676 "whitespace" at <a href="http://go/white+space">go/white+space</a>. 677 <P> 678 <DL> 679 </DL> 680 </DL> 681 <HR> 682 683 <A NAME="JAVA_DIGIT"><!-- --></A><H3> 684 JAVA_DIGIT</H3> 685 <PRE> 686 public static final <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>JAVA_DIGIT</B></PRE> 687 <DL> 688 <DD>Determines whether a character is a digit according to <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Character.html?is-external=true#isDigit(char)" title="class or interface in java.lang"><CODE>Java's definition</CODE></A>. If you only care to match 689 ASCII digits, you can use <code>inRange('0', '9')</code>. 690 <P> 691 <DL> 692 </DL> 693 </DL> 694 <HR> 695 696 <A NAME="JAVA_LETTER"><!-- --></A><H3> 697 JAVA_LETTER</H3> 698 <PRE> 699 public static final <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>JAVA_LETTER</B></PRE> 700 <DL> 701 <DD>Determines whether a character is a letter according to <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Character.html?is-external=true#isLetter(char)" title="class or interface in java.lang"><CODE>Java's definition</CODE></A>. If you only care to match 702 letters of the Latin alphabet, you can use <code>inRange('a', 'z').or(inRange('A', 'Z'))</code>. 703 <P> 704 <DL> 705 </DL> 706 </DL> 707 <HR> 708 709 <A NAME="JAVA_LETTER_OR_DIGIT"><!-- --></A><H3> 710 JAVA_LETTER_OR_DIGIT</H3> 711 <PRE> 712 public static final <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>JAVA_LETTER_OR_DIGIT</B></PRE> 713 <DL> 714 <DD>Determines whether a character is a letter or digit according to <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Character.html?is-external=true#isLetterOrDigit(char)" title="class or interface in java.lang"><CODE>Java's definition</CODE></A>. 715 <P> 716 <DL> 717 </DL> 718 </DL> 719 <HR> 720 721 <A NAME="JAVA_UPPER_CASE"><!-- --></A><H3> 722 JAVA_UPPER_CASE</H3> 723 <PRE> 724 public static final <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>JAVA_UPPER_CASE</B></PRE> 725 <DL> 726 <DD>Determines whether a character is upper case according to <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Character.html?is-external=true#isUpperCase(char)" title="class or interface in java.lang"><CODE>Java's definition</CODE></A>. 727 <P> 728 <DL> 729 </DL> 730 </DL> 731 <HR> 732 733 <A NAME="JAVA_LOWER_CASE"><!-- --></A><H3> 734 JAVA_LOWER_CASE</H3> 735 <PRE> 736 public static final <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>JAVA_LOWER_CASE</B></PRE> 737 <DL> 738 <DD>Determines whether a character is lower case according to <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Character.html?is-external=true#isLowerCase(char)" title="class or interface in java.lang"><CODE>Java's definition</CODE></A>. 739 <P> 740 <DL> 741 </DL> 742 </DL> 743 <HR> 744 745 <A NAME="JAVA_ISO_CONTROL"><!-- --></A><H3> 746 JAVA_ISO_CONTROL</H3> 747 <PRE> 748 public static final <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>JAVA_ISO_CONTROL</B></PRE> 749 <DL> 750 <DD>Determines whether a character is an ISO control character according to 751 <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Character.html?is-external=true#isISOControl(char)" title="class or interface in java.lang"><CODE>Character.isISOControl(char)</CODE></A>. 752 <P> 753 <DL> 754 </DL> 755 </DL> 756 <HR> 757 758 <A NAME="INVISIBLE"><!-- --></A><H3> 759 INVISIBLE</H3> 760 <PRE> 761 public static final <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>INVISIBLE</B></PRE> 762 <DL> 763 <DD>Determines whether a character is invisible; that is, if its Unicode 764 category is any of SPACE_SEPARATOR, LINE_SEPARATOR, 765 PARAGRAPH_SEPARATOR, CONTROL, FORMAT, SURROGATE, and PRIVATE_USE according 766 to ICU4J. 767 <P> 768 <DL> 769 </DL> 770 </DL> 771 <HR> 772 773 <A NAME="SINGLE_WIDTH"><!-- --></A><H3> 774 SINGLE_WIDTH</H3> 775 <PRE> 776 public static final <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>SINGLE_WIDTH</B></PRE> 777 <DL> 778 <DD>Determines whether a character is single-width (not double-width). When 779 in doubt, this matcher errs on the side of returning <code>false</code> (that 780 is, it tends to assume a character is double-width). 781 782 <b>Note:</b> as the reference file evolves, we will modify this constant 783 to keep it up to date. 784 <P> 785 <DL> 786 </DL> 787 </DL> 788 <HR> 789 790 <A NAME="ANY"><!-- --></A><H3> 791 ANY</H3> 792 <PRE> 793 public static final <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>ANY</B></PRE> 794 <DL> 795 <DD>Matches any character. 796 <P> 797 <DL> 798 </DL> 799 </DL> 800 <HR> 801 802 <A NAME="NONE"><!-- --></A><H3> 803 NONE</H3> 804 <PRE> 805 public static final <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>NONE</B></PRE> 806 <DL> 807 <DD>Matches no characters. 808 <P> 809 <DL> 810 </DL> 811 </DL> 812 813 <!-- ========= CONSTRUCTOR DETAIL ======== --> 814 815 <A NAME="constructor_detail"><!-- --></A> 816 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 817 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 818 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 819 <B>Constructor Detail</B></FONT></TH> 820 </TR> 821 </TABLE> 822 823 <A NAME="CharMatcher()"><!-- --></A><H3> 824 CharMatcher</H3> 825 <PRE> 826 public <B>CharMatcher</B>()</PRE> 827 <DL> 828 </DL> 829 830 <!-- ============ METHOD DETAIL ========== --> 831 832 <A NAME="method_detail"><!-- --></A> 833 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 834 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 835 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 836 <B>Method Detail</B></FONT></TH> 837 </TR> 838 </TABLE> 839 840 <A NAME="is(char)"><!-- --></A><H3> 841 is</H3> 842 <PRE> 843 public static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>is</B>(char match)</PRE> 844 <DL> 845 <DD>Returns a <code>char</code> matcher that matches only one specified character. 846 <P> 847 <DD><DL> 848 </DL> 849 </DD> 850 <DD><DL> 851 </DL> 852 </DD> 853 </DL> 854 <HR> 855 856 <A NAME="isNot(char)"><!-- --></A><H3> 857 isNot</H3> 858 <PRE> 859 public static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>isNot</B>(char match)</PRE> 860 <DL> 861 <DD>Returns a <code>char</code> matcher that matches any character except the one 862 specified. 863 864 <p>To negate another <code>CharMatcher</code>, use <A HREF="../../../../com/google/common/base/CharMatcher.html#negate()"><CODE>negate()</CODE></A>. 865 <P> 866 <DD><DL> 867 </DL> 868 </DD> 869 <DD><DL> 870 </DL> 871 </DD> 872 </DL> 873 <HR> 874 875 <A NAME="anyOf(java.lang.CharSequence)"><!-- --></A><H3> 876 anyOf</H3> 877 <PRE> 878 public static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>anyOf</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence)</PRE> 879 <DL> 880 <DD>Returns a <code>char</code> matcher that matches any character present in the 881 given character sequence. 882 <P> 883 <DD><DL> 884 </DL> 885 </DD> 886 <DD><DL> 887 </DL> 888 </DD> 889 </DL> 890 <HR> 891 892 <A NAME="noneOf(java.lang.CharSequence)"><!-- --></A><H3> 893 noneOf</H3> 894 <PRE> 895 public static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>noneOf</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence)</PRE> 896 <DL> 897 <DD>Returns a <code>char</code> matcher that matches any character not present in 898 the given character sequence. 899 <P> 900 <DD><DL> 901 </DL> 902 </DD> 903 <DD><DL> 904 </DL> 905 </DD> 906 </DL> 907 <HR> 908 909 <A NAME="inRange(char, char)"><!-- --></A><H3> 910 inRange</H3> 911 <PRE> 912 public static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>inRange</B>(char startInclusive, 913 char endInclusive)</PRE> 914 <DL> 915 <DD>Returns a <code>char</code> matcher that matches any character in a given range 916 (both endpoints are inclusive). For example, to match any lowercase letter 917 of the English alphabet, use <code>CharMatcher.inRange('a', 'z')</code>. 918 <P> 919 <DD><DL> 920 </DL> 921 </DD> 922 <DD><DL> 923 924 <DT><B>Throws:</B> 925 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if <code>endInclusive < startInclusive</code></DL> 926 </DD> 927 </DL> 928 <HR> 929 930 <A NAME="forPredicate(com.google.common.base.Predicate)"><!-- --></A><H3> 931 forPredicate</H3> 932 <PRE> 933 public static <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>forPredicate</B>(<A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><? super <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Character.html?is-external=true" title="class or interface in java.lang">Character</A>> predicate)</PRE> 934 <DL> 935 <DD>Returns a matcher with identical behavior to the given <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Character.html?is-external=true" title="class or interface in java.lang"><CODE>Character</CODE></A>-based predicate, but which operates on primitive <code>char</code> 936 instances instead. 937 <P> 938 <DD><DL> 939 </DL> 940 </DD> 941 <DD><DL> 942 </DL> 943 </DD> 944 </DL> 945 <HR> 946 947 <A NAME="matches(char)"><!-- --></A><H3> 948 matches</H3> 949 <PRE> 950 public abstract boolean <B>matches</B>(char c)</PRE> 951 <DL> 952 <DD>Determines a true or false value for the given character. 953 <P> 954 <DD><DL> 955 </DL> 956 </DD> 957 <DD><DL> 958 </DL> 959 </DD> 960 </DL> 961 <HR> 962 963 <A NAME="negate()"><!-- --></A><H3> 964 negate</H3> 965 <PRE> 966 public <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>negate</B>()</PRE> 967 <DL> 968 <DD>Returns a matcher that matches any character not matched by this matcher. 969 <P> 970 <DD><DL> 971 </DL> 972 </DD> 973 <DD><DL> 974 </DL> 975 </DD> 976 </DL> 977 <HR> 978 979 <A NAME="and(com.google.common.base.CharMatcher)"><!-- --></A><H3> 980 and</H3> 981 <PRE> 982 public <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>and</B>(<A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> other)</PRE> 983 <DL> 984 <DD>Returns a matcher that matches any character matched by both this matcher 985 and <code>other</code>. 986 <P> 987 <DD><DL> 988 </DL> 989 </DD> 990 <DD><DL> 991 </DL> 992 </DD> 993 </DL> 994 <HR> 995 996 <A NAME="or(com.google.common.base.CharMatcher)"><!-- --></A><H3> 997 or</H3> 998 <PRE> 999 public <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>or</B>(<A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> other)</PRE> 1000 <DL> 1001 <DD>Returns a matcher that matches any character matched by either this matcher 1002 or <code>other</code>. 1003 <P> 1004 <DD><DL> 1005 </DL> 1006 </DD> 1007 <DD><DL> 1008 </DL> 1009 </DD> 1010 </DL> 1011 <HR> 1012 1013 <A NAME="precomputed()"><!-- --></A><H3> 1014 precomputed</H3> 1015 <PRE> 1016 public <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A> <B>precomputed</B>()</PRE> 1017 <DL> 1018 <DD>Returns a <code>char</code> matcher functionally equivalent to this one, but 1019 which may be faster to query than the original; your mileage may vary. 1020 Precomputation takes time and is likely to be worthwhile only if the 1021 precomputed matcher is queried many thousands of times. 1022 1023 <p>This method has no effect (returns <code>this</code>) when called in GWT: 1024 it's unclear whether a precomputed matcher is faster, but it certainly 1025 consumes more memory, which doesn't seem like a worthwhile tradeoff in a 1026 browser. 1027 <P> 1028 <DD><DL> 1029 </DL> 1030 </DD> 1031 <DD><DL> 1032 </DL> 1033 </DD> 1034 </DL> 1035 <HR> 1036 1037 <A NAME="setBits(com.google.common.base.CharMatcher.LookupTable)"><!-- --></A><H3> 1038 setBits</H3> 1039 <PRE> 1040 protected void <B>setBits</B>(<A HREF="../../../../com/google/common/base/CharMatcher.LookupTable.html" title="class in com.google.common.base">CharMatcher.LookupTable</A> table)</PRE> 1041 <DL> 1042 <DD>For use by implementors; sets the bit corresponding to each character ('\0' 1043 to '\uFFFF') that matches this matcher in the given bit array, 1044 leaving all other bits untouched. 1045 1046 <p>The default implementation loops over every possible character value, 1047 invoking <A HREF="../../../../com/google/common/base/CharMatcher.html#matches(char)"><CODE>matches(char)</CODE></A> for each one. 1048 <P> 1049 <DD><DL> 1050 </DL> 1051 </DD> 1052 <DD><DL> 1053 </DL> 1054 </DD> 1055 </DL> 1056 <HR> 1057 1058 <A NAME="matchesAllOf(java.lang.CharSequence)"><!-- --></A><H3> 1059 matchesAllOf</H3> 1060 <PRE> 1061 public boolean <B>matchesAllOf</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence)</PRE> 1062 <DL> 1063 <DD>Returns <code>true</code> if a character sequence contains only matching 1064 characters. 1065 1066 <p>The default implementation iterates over the sequence, invoking <A HREF="../../../../com/google/common/base/CharMatcher.html#matches(char)"><CODE>matches(char)</CODE></A> for each character, until this returns <code>false</code> or the end 1067 is reached. 1068 <P> 1069 <DD><DL> 1070 </DL> 1071 </DD> 1072 <DD><DL> 1073 <DT><B>Parameters:</B><DD><CODE>sequence</CODE> - the character sequence to examine, possibly empty 1074 <DT><B>Returns:</B><DD><code>true</code> if this matcher matches every character in the 1075 sequence, including when the sequence is empty</DL> 1076 </DD> 1077 </DL> 1078 <HR> 1079 1080 <A NAME="matchesNoneOf(java.lang.CharSequence)"><!-- --></A><H3> 1081 matchesNoneOf</H3> 1082 <PRE> 1083 public boolean <B>matchesNoneOf</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence)</PRE> 1084 <DL> 1085 <DD>Returns <code>true</code> if a character sequence contains no matching 1086 characters. 1087 1088 <p>The default implementation iterates over the sequence, invoking <A HREF="../../../../com/google/common/base/CharMatcher.html#matches(char)"><CODE>matches(char)</CODE></A> for each character, until this returns <code>false</code> or the end is 1089 reached. 1090 <P> 1091 <DD><DL> 1092 </DL> 1093 </DD> 1094 <DD><DL> 1095 <DT><B>Parameters:</B><DD><CODE>sequence</CODE> - the character sequence to examine, possibly empty 1096 <DT><B>Returns:</B><DD><code>true</code> if this matcher matches every character in the 1097 sequence, including when the sequence is empty</DL> 1098 </DD> 1099 </DL> 1100 <HR> 1101 1102 <A NAME="indexIn(java.lang.CharSequence)"><!-- --></A><H3> 1103 indexIn</H3> 1104 <PRE> 1105 public int <B>indexIn</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence)</PRE> 1106 <DL> 1107 <DD>Returns the index of the first matching character in a character sequence, 1108 or <code>-1</code> if no matching character is present. 1109 1110 <p>The default implementation iterates over the sequence in forward order 1111 calling <A HREF="../../../../com/google/common/base/CharMatcher.html#matches(char)"><CODE>matches(char)</CODE></A> for each character. 1112 <P> 1113 <DD><DL> 1114 </DL> 1115 </DD> 1116 <DD><DL> 1117 <DT><B>Parameters:</B><DD><CODE>sequence</CODE> - the character sequence to examine from the beginning 1118 <DT><B>Returns:</B><DD>an index, or <code>-1</code> if no character matches</DL> 1119 </DD> 1120 </DL> 1121 <HR> 1122 1123 <A NAME="indexIn(java.lang.CharSequence, int)"><!-- --></A><H3> 1124 indexIn</H3> 1125 <PRE> 1126 public int <B>indexIn</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence, 1127 int start)</PRE> 1128 <DL> 1129 <DD>Returns the index of the first matching character in a character sequence, 1130 starting from a given position, or <code>-1</code> if no character matches after 1131 that position. 1132 1133 <p>The default implementation iterates over the sequence in forward order, 1134 beginning at <code>start</code>, calling <A HREF="../../../../com/google/common/base/CharMatcher.html#matches(char)"><CODE>matches(char)</CODE></A> for each character. 1135 <P> 1136 <DD><DL> 1137 </DL> 1138 </DD> 1139 <DD><DL> 1140 <DT><B>Parameters:</B><DD><CODE>sequence</CODE> - the character sequence to examine<DD><CODE>start</CODE> - the first index to examine; must be nonnegative and no 1141 greater than <code>sequence.length()</code> 1142 <DT><B>Returns:</B><DD>the index of the first matching character, guaranteed to be no less 1143 than <code>start</code>, or <code>-1</code> if no character matches 1144 <DT><B>Throws:</B> 1145 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang">IndexOutOfBoundsException</A></CODE> - if start is negative or greater than 1146 <code>sequence.length()</code></DL> 1147 </DD> 1148 </DL> 1149 <HR> 1150 1151 <A NAME="lastIndexIn(java.lang.CharSequence)"><!-- --></A><H3> 1152 lastIndexIn</H3> 1153 <PRE> 1154 public int <B>lastIndexIn</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence)</PRE> 1155 <DL> 1156 <DD>Returns the index of the last matching character in a character sequence, 1157 or <code>-1</code> if no matching character is present. 1158 1159 <p>The default implementation iterates over the sequence in reverse order 1160 calling <A HREF="../../../../com/google/common/base/CharMatcher.html#matches(char)"><CODE>matches(char)</CODE></A> for each character. 1161 <P> 1162 <DD><DL> 1163 </DL> 1164 </DD> 1165 <DD><DL> 1166 <DT><B>Parameters:</B><DD><CODE>sequence</CODE> - the character sequence to examine from the end 1167 <DT><B>Returns:</B><DD>an index, or <code>-1</code> if no character matches</DL> 1168 </DD> 1169 </DL> 1170 <HR> 1171 1172 <A NAME="countIn(java.lang.CharSequence)"><!-- --></A><H3> 1173 countIn</H3> 1174 <PRE> 1175 public int <B>countIn</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence)</PRE> 1176 <DL> 1177 <DD>Returns the number of matching characters found in a character sequence. 1178 <P> 1179 <DD><DL> 1180 </DL> 1181 </DD> 1182 <DD><DL> 1183 </DL> 1184 </DD> 1185 </DL> 1186 <HR> 1187 1188 <A NAME="removeFrom(java.lang.CharSequence)"><!-- --></A><H3> 1189 removeFrom</H3> 1190 <PRE> 1191 public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>removeFrom</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence)</PRE> 1192 <DL> 1193 <DD>Returns a string containing all non-matching characters of a character 1194 sequence, in order. For example: <pre> <code>CharMatcher.is('a').removeFrom("bazaar")</code></pre> 1195 1196 ... returns <code>"bzr"</code>. 1197 <P> 1198 <DD><DL> 1199 </DL> 1200 </DD> 1201 <DD><DL> 1202 </DL> 1203 </DD> 1204 </DL> 1205 <HR> 1206 1207 <A NAME="retainFrom(java.lang.CharSequence)"><!-- --></A><H3> 1208 retainFrom</H3> 1209 <PRE> 1210 public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>retainFrom</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence)</PRE> 1211 <DL> 1212 <DD>Returns a string containing all matching characters of a character 1213 sequence, in order. For example: <pre> <code>CharMatcher.is('a').retainFrom("bazaar")</code></pre> 1214 1215 ... returns <code>"aaa"</code>. 1216 <P> 1217 <DD><DL> 1218 </DL> 1219 </DD> 1220 <DD><DL> 1221 </DL> 1222 </DD> 1223 </DL> 1224 <HR> 1225 1226 <A NAME="replaceFrom(java.lang.CharSequence, char)"><!-- --></A><H3> 1227 replaceFrom</H3> 1228 <PRE> 1229 public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>replaceFrom</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence, 1230 char replacement)</PRE> 1231 <DL> 1232 <DD>Returns a string copy of the input character sequence, with each character 1233 that matches this matcher replaced by a given replacement character. For 1234 example: <pre> <code>CharMatcher.is('a').replaceFrom("radar", 'o')</code></pre> 1235 1236 ... returns <code>"rodor"</code>. 1237 1238 <p>The default implementation uses <A HREF="../../../../com/google/common/base/CharMatcher.html#indexIn(java.lang.CharSequence)"><CODE>indexIn(CharSequence)</CODE></A> to find 1239 the first matching character, then iterates the remainder of the sequence 1240 calling <A HREF="../../../../com/google/common/base/CharMatcher.html#matches(char)"><CODE>matches(char)</CODE></A> for each character. 1241 <P> 1242 <DD><DL> 1243 </DL> 1244 </DD> 1245 <DD><DL> 1246 <DT><B>Parameters:</B><DD><CODE>sequence</CODE> - the character sequence to replace matching characters in<DD><CODE>replacement</CODE> - the character to append to the result string in place of 1247 each matching character in <code>sequence</code> 1248 <DT><B>Returns:</B><DD>the new string</DL> 1249 </DD> 1250 </DL> 1251 <HR> 1252 1253 <A NAME="replaceFrom(java.lang.CharSequence, java.lang.CharSequence)"><!-- --></A><H3> 1254 replaceFrom</H3> 1255 <PRE> 1256 public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>replaceFrom</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence, 1257 <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> replacement)</PRE> 1258 <DL> 1259 <DD>Returns a string copy of the input character sequence, with each character 1260 that matches this matcher replaced by a given replacement sequence. For 1261 example: <pre> <code>CharMatcher.is('a').replaceFrom("yaha", "oo")</code></pre> 1262 1263 ... returns <code>"yoohoo"</code>. 1264 1265 <p><b>Note:</b> If the replacement is a fixed string with only one character, 1266 you are better off calling <A HREF="../../../../com/google/common/base/CharMatcher.html#replaceFrom(java.lang.CharSequence, char)"><CODE>replaceFrom(CharSequence, char)</CODE></A> directly. 1267 <P> 1268 <DD><DL> 1269 </DL> 1270 </DD> 1271 <DD><DL> 1272 <DT><B>Parameters:</B><DD><CODE>sequence</CODE> - the character sequence to replace matching characters in<DD><CODE>replacement</CODE> - the characters to append to the result string in place 1273 of each matching character in <code>sequence</code> 1274 <DT><B>Returns:</B><DD>the new string</DL> 1275 </DD> 1276 </DL> 1277 <HR> 1278 1279 <A NAME="trimFrom(java.lang.CharSequence)"><!-- --></A><H3> 1280 trimFrom</H3> 1281 <PRE> 1282 public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>trimFrom</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence)</PRE> 1283 <DL> 1284 <DD>Returns a substring of the input character sequence that omits all 1285 characters this matcher matches from the beginning and from the end of the 1286 string. For example: <pre> <code>CharMatcher.anyOf("ab").trimFrom("abacatbab")</code></pre> 1287 1288 ... returns <code>"cat"</code>. 1289 1290 <p>Note that<pre> <code>CharMatcher.inRange('\0', ' ').trimFrom(str)</code></pre> 1291 1292 ... is equivalent to <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true#trim()" title="class or interface in java.lang"><CODE>String.trim()</CODE></A>. 1293 <P> 1294 <DD><DL> 1295 </DL> 1296 </DD> 1297 <DD><DL> 1298 </DL> 1299 </DD> 1300 </DL> 1301 <HR> 1302 1303 <A NAME="trimLeadingFrom(java.lang.CharSequence)"><!-- --></A><H3> 1304 trimLeadingFrom</H3> 1305 <PRE> 1306 public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>trimLeadingFrom</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence)</PRE> 1307 <DL> 1308 <DD>Returns a substring of the input character sequence that omits all 1309 characters this matcher matches from the beginning of the 1310 string. For example: <pre> <code>CharMatcher.anyOf("ab").trimLeadingFrom("abacatbab")</code></pre> 1311 1312 ... returns <code>"catbab"</code>. 1313 <P> 1314 <DD><DL> 1315 </DL> 1316 </DD> 1317 <DD><DL> 1318 </DL> 1319 </DD> 1320 </DL> 1321 <HR> 1322 1323 <A NAME="trimTrailingFrom(java.lang.CharSequence)"><!-- --></A><H3> 1324 trimTrailingFrom</H3> 1325 <PRE> 1326 public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>trimTrailingFrom</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence)</PRE> 1327 <DL> 1328 <DD>Returns a substring of the input character sequence that omits all 1329 characters this matcher matches from the end of the 1330 string. For example: <pre> <code>CharMatcher.anyOf("ab").trimTrailingFrom("abacatbab")</code></pre> 1331 1332 ... returns <code>"abacat"</code>. 1333 <P> 1334 <DD><DL> 1335 </DL> 1336 </DD> 1337 <DD><DL> 1338 </DL> 1339 </DD> 1340 </DL> 1341 <HR> 1342 1343 <A NAME="collapseFrom(java.lang.CharSequence, char)"><!-- --></A><H3> 1344 collapseFrom</H3> 1345 <PRE> 1346 public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>collapseFrom</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence, 1347 char replacement)</PRE> 1348 <DL> 1349 <DD>Returns a string copy of the input character sequence, with each group of 1350 consecutive characters that match this matcher replaced by a single 1351 replacement character. For example: <pre> <code>CharMatcher.anyOf("eko").collapseFrom("bookkeeper", '-')</code></pre> 1352 1353 ... returns <code>"b-p-r"</code>. 1354 1355 <p>The default implementation uses <A HREF="../../../../com/google/common/base/CharMatcher.html#indexIn(java.lang.CharSequence)"><CODE>indexIn(CharSequence)</CODE></A> to find 1356 the first matching character, then iterates the remainder of the sequence 1357 calling <A HREF="../../../../com/google/common/base/CharMatcher.html#matches(char)"><CODE>matches(char)</CODE></A> for each character. 1358 <P> 1359 <DD><DL> 1360 </DL> 1361 </DD> 1362 <DD><DL> 1363 <DT><B>Parameters:</B><DD><CODE>sequence</CODE> - the character sequence to replace matching groups of 1364 characters in<DD><CODE>replacement</CODE> - the character to append to the result string in place of 1365 each group of matching characters in <code>sequence</code> 1366 <DT><B>Returns:</B><DD>the new string</DL> 1367 </DD> 1368 </DL> 1369 <HR> 1370 1371 <A NAME="trimAndCollapseFrom(java.lang.CharSequence, char)"><!-- --></A><H3> 1372 trimAndCollapseFrom</H3> 1373 <PRE> 1374 public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>trimAndCollapseFrom</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> sequence, 1375 char replacement)</PRE> 1376 <DL> 1377 <DD>Collapses groups of matching characters exactly as <A HREF="../../../../com/google/common/base/CharMatcher.html#collapseFrom(java.lang.CharSequence, char)"><CODE>collapseFrom(java.lang.CharSequence, char)</CODE></A> 1378 does, except that groups of matching characters at the start or end of the 1379 sequence are removed without replacement. 1380 <P> 1381 <DD><DL> 1382 </DL> 1383 </DD> 1384 <DD><DL> 1385 </DL> 1386 </DD> 1387 </DL> 1388 <HR> 1389 1390 <A NAME="apply(java.lang.Character)"><!-- --></A><H3> 1391 apply</H3> 1392 <PRE> 1393 public boolean <B>apply</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Character.html?is-external=true" title="class or interface in java.lang">Character</A> character)</PRE> 1394 <DL> 1395 <DD>Returns <code>true</code> if this matcher matches the given character. 1396 <P> 1397 <DD><DL> 1398 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../com/google/common/base/Predicate.html#apply(T)">apply</A></CODE> in interface <CODE><A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Character.html?is-external=true" title="class or interface in java.lang">Character</A>></CODE></DL> 1399 </DD> 1400 <DD><DL> 1401 <DT><B>Parameters:</B><DD><CODE>character</CODE> - the input that the predicate should act on 1402 <DT><B>Returns:</B><DD>the value of this predicate when applied to the input <code>t</code> 1403 <DT><B>Throws:</B> 1404 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</A></CODE> - if <code>character</code> is null</DL> 1405 </DD> 1406 </DL> 1407 <!-- ========= END OF CLASS DATA ========= --> 1408 <HR> 1409 1410 1411 <!-- ======= START OF BOTTOM NAVBAR ====== --> 1412 <A NAME="navbar_bottom"><!-- --></A> 1413 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> 1414 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 1415 <TR> 1416 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 1417 <A NAME="navbar_bottom_firstrow"><!-- --></A> 1418 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 1419 <TR ALIGN="center" VALIGN="top"> 1420 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 1421 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 1422 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 1423 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/CharMatcher.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 1424 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 1425 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 1426 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 1427 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 1428 </TR> 1429 </TABLE> 1430 </TD> 1431 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 1432 </EM> 1433 </TD> 1434 </TR> 1435 1436 <TR> 1437 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 1438 <A HREF="../../../../com/google/common/base/CaseFormat.html" title="enum in com.google.common.base"><B>PREV CLASS</B></A> 1439 <A HREF="../../../../com/google/common/base/CharMatcher.LookupTable.html" title="class in com.google.common.base"><B>NEXT CLASS</B></A></FONT></TD> 1440 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 1441 <A HREF="../../../../index.html?com/google/common/base/CharMatcher.html" target="_top"><B>FRAMES</B></A> 1442 <A HREF="CharMatcher.html" target="_top"><B>NO FRAMES</B></A> 1443 <SCRIPT type="text/javascript"> 1444 <!-- 1445 if(window==top) { 1446 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); 1447 } 1448 //--> 1449 </SCRIPT> 1450 <NOSCRIPT> 1451 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> 1452 </NOSCRIPT> 1453 1454 1455 </FONT></TD> 1456 </TR> 1457 <TR> 1458 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 1459 SUMMARY: <A HREF="#nested_class_summary">NESTED</A> | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> 1460 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 1461 DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> 1462 </TR> 1463 </TABLE> 1464 <A NAME="skip-navbar_bottom"></A> 1465 <!-- ======== END OF BOTTOM NAVBAR ======= --> 1466 1467 <HR> 1468 1469 </BODY> 1470 </HTML> 1471