<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0-google-internal) on Mon Jan 04 20:47:57 PST 2010 -->
<TITLE>
Splitter (Guava Libraries 2010.01.04)
</TITLE>

<META NAME="date" CONTENT="2010-01-04">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">
function windowTitle()
{
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="Splitter (Guava Libraries 2010.01.04)";
    }
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">
<HR>


<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Splitter.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../com/google/common/base/Service.State.html" title="enum in com.google.common.base"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../com/google/common/base/Supplier.html" title="interface in com.google.common.base"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../index.html?com/google/common/base/Splitter.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="Splitter.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
com.google.common.base</FONT>
<BR>
Class Splitter</H2>
<PRE>
<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>
  <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.google.common.base.Splitter</B>
</PRE>
<HR>
<DL>
<DT><PRE>public final class <B>Splitter</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></DL>
</PRE>

<P>
An object that divides strings (or other instances of <code>CharSequence</code>)
 into substrings, by recognizing a <i>separator</i> (a.k.a. "delimiter")
 which can be expressed as a single character, literal string, regular
 expression, <code>CharMatcher</code>, or by using a fixed substring length. This
 class provides the complementary functionality to <A HREF="../../../../com/google/common/base/Joiner.html" title="class in com.google.common.base"><CODE>Joiner</CODE></A>.

 <p>Here is the most basic example of <code>Splitter</code> usage: <pre>   <code>Splitter.on(',').split("foo,bar")</code></pre>

 This invocation returns an <code>Iterable&lt;String&gt;</code> containing <code>"foo"</code>
 and <code>"bar"</code>, in that order.

 <p>By default <code>Splitter</code>'s behavior is very simplistic: <pre>   <code>Splitter.on(',').split("foo,,bar,  quux")</code></pre>

 This returns an iterable containing <code>["foo", "", "bar", "  quux"]</code>.
 Notice that the splitter does not assume that you want empty strings removed,
 or that you wish to trim whitespace. If you want features like these, simply
 ask for them: <pre> <code>private static final Splitter MY_SPLITTER = Splitter.on(',')
       .trimResults()
       .omitEmptyStrings();</code></pre>

 Now <code>MY_SPLITTER.split("foo, ,bar,  quux,")</code> returns an iterable
 containing just <code>["foo", "bar", "quux"]</code>. Note that the order in which
 the configuration methods are called is never significant; for instance,
 trimming is always applied first before checking for an empty result,
 regardless of the order in which the <A HREF="../../../../com/google/common/base/Splitter.html#trimResults()"><CODE>trimResults()</CODE></A> and
 <A HREF="../../../../com/google/common/base/Splitter.html#omitEmptyStrings()"><CODE>omitEmptyStrings()</CODE></A> methods were invoked.

 <p><b>Warning: splitter instances are always immutable</b>; a configuration
 method such as <code>omitEmptyStrings</code> has no effect on the instance it
 is invoked on! You must store and use the new splitter instance returned by
 the method. This makes splitters thread-safe, and safe to store as <code>static final</code> constants (as illustrated above). <pre>   <code>// Bad! Do not do this!
   Splitter splitter = Splitter.on('/');
   splitter.trimResults(); // does nothing!
   return splitter.split("wrong / wrong / wrong");</code></pre>

 The separator recognized by the splitter does not have to be a single
 literal character as in the examples above. See the methods <A HREF="../../../../com/google/common/base/Splitter.html#on(java.lang.String)"><CODE>on(String)</CODE></A>, <A HREF="../../../../com/google/common/base/Splitter.html#on(java.util.regex.Pattern)"><CODE>on(Pattern)</CODE></A> and <A HREF="../../../../com/google/common/base/Splitter.html#on(com.google.common.base.CharMatcher)"><CODE>on(CharMatcher)</CODE></A> for examples
 of other ways to specify separators.

 <p><b>Note:</b> this class does not mimic any of the quirky behaviors of
 similar JDK methods; for instance, it does not silently discard trailing
 separators, as does <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true#split(java.lang.String)" title="class or interface in java.lang"><CODE>String.split(String)</CODE></A>, nor does it have a default
 behavior of using five particular whitespace characters as separators, like
 <A HREF="http://java.sun.com/javase/6/docs/api/java/util/StringTokenizer.html?is-external=true" title="class or interface in java.util"><CODE>StringTokenizer</CODE></A>.
<P>

<P>
<DL>
<DT><B>Since:</B></DT>
  <DD>2009.09.15 <b>tentative</b></DD>
<DT><B>Author:</B></DT>
  <DD>Julien Silland, Jesse Wilson, Kevin Bourrillion</DD>
</DL>
<HR>

<P>

<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../com/google/common/base/Splitter.html" title="class in com.google.common.base">Splitter</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/base/Splitter.html#fixedLength(int)">fixedLength</A></B>(int&nbsp;length)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a splitter that divides strings into pieces of the given length.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../com/google/common/base/Splitter.html" title="class in com.google.common.base">Splitter</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/base/Splitter.html#omitEmptyStrings()">omitEmptyStrings</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a splitter that behaves equivalently to <code>this</code> splitter, but
 automatically omits empty strings from the results.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../com/google/common/base/Splitter.html" title="class in com.google.common.base">Splitter</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/base/Splitter.html#on(char)">on</A></B>(char&nbsp;separator)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a splitter that uses the given single-character separator.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../com/google/common/base/Splitter.html" title="class in com.google.common.base">Splitter</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/base/Splitter.html#on(com.google.common.base.CharMatcher)">on</A></B>(<A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A>&nbsp;separatorMatcher)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a splitter that considers any single character matched by the
 given <code>CharMatcher</code> to be a separator.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../com/google/common/base/Splitter.html" title="class in com.google.common.base">Splitter</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/base/Splitter.html#on(java.util.regex.Pattern)">on</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/regex/Pattern.html?is-external=true" title="class or interface in java.util.regex">Pattern</A>&nbsp;separatorPattern)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a splitter that considers any subsequence matching <code>pattern</code> to be a separator.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../com/google/common/base/Splitter.html" title="class in com.google.common.base">Splitter</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/base/Splitter.html#on(java.lang.String)">on</A></B>(<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>&nbsp;separator)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a splitter that uses the given fixed string as a separator.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../com/google/common/base/Splitter.html" title="class in com.google.common.base">Splitter</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/base/Splitter.html#onPattern(java.lang.String)">onPattern</A></B>(<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>&nbsp;separatorPattern)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a splitter that considers any subsequence matching a given
 pattern (regular expression) to be a separator.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A>&lt;<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>&gt;</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/base/Splitter.html#split(java.lang.CharSequence)">split</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>&nbsp;sequence)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Splits the <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang"><CODE>CharSequence</CODE></A> passed in parameter.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../com/google/common/base/Splitter.html" title="class in com.google.common.base">Splitter</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/base/Splitter.html#trimResults()">trimResults</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a splitter that behaves equivalently to <code>this</code> splitter, but
 automatically removes leading and trailing <A HREF="../../../../com/google/common/base/CharMatcher.html#WHITESPACE">whitespace</A> from each returned substring; equivalent
 to <code>trimResults(CharMatcher.WHITESPACE)</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../com/google/common/base/Splitter.html" title="class in com.google.common.base">Splitter</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/base/Splitter.html#trimResults(com.google.common.base.CharMatcher)">trimResults</A></B>(<A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A>&nbsp;trimmer)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a splitter that behaves equivalently to <code>this</code> splitter, but
 removes all leading or trailing characters matching the given <code>CharMatcher</code> from each returned substring.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<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>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<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>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="on(char)"><!-- --></A><H3>
on</H3>
<PRE>
public static <A HREF="../../../../com/google/common/base/Splitter.html" title="class in com.google.common.base">Splitter</A> <B>on</B>(char&nbsp;separator)</PRE>
<DL>
<DD>Returns a splitter that uses the given single-character separator. For
 example, <code>Splitter.on(',').split("foo,,bar")</code> returns an iterable
 containing <code>["foo", "", "bar"]</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>separator</CODE> - the character to recognize as a separator
<DT><B>Returns:</B><DD>a splitter, with default settings, that recognizes that separator</DL>
</DD>
</DL>
<HR>

<A NAME="on(com.google.common.base.CharMatcher)"><!-- --></A><H3>
on</H3>
<PRE>
public static <A HREF="../../../../com/google/common/base/Splitter.html" title="class in com.google.common.base">Splitter</A> <B>on</B>(<A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A>&nbsp;separatorMatcher)</PRE>
<DL>
<DD>Returns a splitter that considers any single character matched by the
 given <code>CharMatcher</code> to be a separator. For example, <code>Splitter.on(CharMatcher.anyOf(";,")).split("foo,;bar,quux")</code> returns an
 iterable containing <code>["foo", "", "bar", "quux"]</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>separatorMatcher</CODE> - a <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base"><CODE>CharMatcher</CODE></A> that determines whether a
     character is a separator
<DT><B>Returns:</B><DD>a splitter, with default settings, that uses this matcher</DL>
</DD>
</DL>
<HR>

<A NAME="on(java.lang.String)"><!-- --></A><H3>
on</H3>
<PRE>
public static <A HREF="../../../../com/google/common/base/Splitter.html" title="class in com.google.common.base">Splitter</A> <B>on</B>(<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>&nbsp;separator)</PRE>
<DL>
<DD>Returns a splitter that uses the given fixed string as a separator. For
 example, <code>Splitter.on(", ").split("foo, bar, baz,qux")</code> returns an
 iterable containing <code>["foo", "bar", "baz,qux"]</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>separator</CODE> - the literal, nonempty string to recognize as a separator
<DT><B>Returns:</B><DD>a splitter, with default settings, that recognizes that separator</DL>
</DD>
</DL>
<HR>

<A NAME="on(java.util.regex.Pattern)"><!-- --></A><H3>
on</H3>
<PRE>
public static <A HREF="../../../../com/google/common/base/Splitter.html" title="class in com.google.common.base">Splitter</A> <B>on</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/regex/Pattern.html?is-external=true" title="class or interface in java.util.regex">Pattern</A>&nbsp;separatorPattern)</PRE>
<DL>
<DD>Returns a splitter that considers any subsequence matching <code>pattern</code> to be a separator. For example, <code>Splitter.on(Pattern.compile("\r?\n")).split(entireFile)</code> splits a string
 into lines whether it uses DOS-style or UNIX-style line terminators.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>separatorPattern</CODE> - the pattern that determines whether a subsequence
     is a separator. This pattern may not match the empty string.
<DT><B>Returns:</B><DD>a splitter, with default settings, that uses this pattern
<DT><B>Throws:</B>
<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>separatorPattern</code> matches the
     empty string</DL>
</DD>
</DL>
<HR>

<A NAME="onPattern(java.lang.String)"><!-- --></A><H3>
onPattern</H3>
<PRE>
public static <A HREF="../../../../com/google/common/base/Splitter.html" title="class in com.google.common.base">Splitter</A> <B>onPattern</B>(<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>&nbsp;separatorPattern)</PRE>
<DL>
<DD>Returns a splitter that considers any subsequence matching a given
 pattern (regular expression) to be a separator. For example, <code>Splitter.onPattern("\r?\n").split(entireFile)</code> splits a string into lines
 whether it uses DOS-style or UNIX-style line terminators. This is
 equivalent to <code>Splitter.on(Pattern.compile(pattern))</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>separatorPattern</CODE> - the pattern that determines whether a subsequence
     is a separator. This pattern may not match the empty string.
<DT><B>Returns:</B><DD>a splitter, with default settings, that uses this pattern
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/util/regex/PatternSyntaxException.html?is-external=true" title="class or interface in java.util.regex">PatternSyntaxException</A></CODE> - if <code>separatorPattern</code> is a malformed
     expression
<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>separatorPattern</code> matches the
     empty string</DL>
</DD>
</DL>
<HR>

<A NAME="fixedLength(int)"><!-- --></A><H3>
fixedLength</H3>
<PRE>
public static <A HREF="../../../../com/google/common/base/Splitter.html" title="class in com.google.common.base">Splitter</A> <B>fixedLength</B>(int&nbsp;length)</PRE>
<DL>
<DD>Returns a splitter that divides strings into pieces of the given length.
 For example, <code>Splitter.atEach(2).split("abcde")</code> returns an
 iterable containing <code>["ab", "cd", "e"]</code>. The last piece can be
 smaller than <code>length</code> but will never be empty.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>length</CODE> - the desired length of pieces after splitting
<DT><B>Returns:</B><DD>a splitter, with default settings, that can split into fixed sized
     pieces</DL>
</DD>
</DL>
<HR>

<A NAME="omitEmptyStrings()"><!-- --></A><H3>
omitEmptyStrings</H3>
<PRE>
public <A HREF="../../../../com/google/common/base/Splitter.html" title="class in com.google.common.base">Splitter</A> <B>omitEmptyStrings</B>()</PRE>
<DL>
<DD>Returns a splitter that behaves equivalently to <code>this</code> splitter, but
 automatically omits empty strings from the results. For example, <code>Splitter.on(',').omitEmptyStrings().split(",a,,,b,c,,")</code> returns an
 iterable containing only <code>["a", "b", "c"]</code>.

 <p>If either <code>trimResults</code> option is also specified when creating a
 splitter, that splitter always trims results first before checking for
 emptiness. So, for example, <code>Splitter.on(':').omitEmptyStrings().trimResults().split(": : : ")</code> returns
 an empty iterable.

 <p>Note that it is ordinarily not possible for <A HREF="../../../../com/google/common/base/Splitter.html#split(java.lang.CharSequence)"><CODE>split(CharSequence)</CODE></A>
 to return an empty iterable, but when using this option, it can (if the
 input sequence consists of nothing but separators).
<P>
<DD><DL>

<DT><B>Returns:</B><DD>a splitter with the desired configuration</DL>
</DD>
</DL>
<HR>

<A NAME="trimResults()"><!-- --></A><H3>
trimResults</H3>
<PRE>
public <A HREF="../../../../com/google/common/base/Splitter.html" title="class in com.google.common.base">Splitter</A> <B>trimResults</B>()</PRE>
<DL>
<DD>Returns a splitter that behaves equivalently to <code>this</code> splitter, but
 automatically removes leading and trailing <A HREF="../../../../com/google/common/base/CharMatcher.html#WHITESPACE">whitespace</A> from each returned substring; equivalent
 to <code>trimResults(CharMatcher.WHITESPACE)</code>. For example, <code>Splitter.on(',').trimResults().split(" a, b  ,c  ")</code> returns an iterable
 containing <code>["a", "b", "c"]</code>.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>a splitter with the desired configuration</DL>
</DD>
</DL>
<HR>

<A NAME="trimResults(com.google.common.base.CharMatcher)"><!-- --></A><H3>
trimResults</H3>
<PRE>
public <A HREF="../../../../com/google/common/base/Splitter.html" title="class in com.google.common.base">Splitter</A> <B>trimResults</B>(<A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base">CharMatcher</A>&nbsp;trimmer)</PRE>
<DL>
<DD>Returns a splitter that behaves equivalently to <code>this</code> splitter, but
 removes all leading or trailing characters matching the given <code>CharMatcher</code> from each returned substring. For example, <code>Splitter.on(',').trimResults(CharMatcher.is('_')).split("_a ,_b_ ,c__")</code>
 returns an iterable containing <code>["a ", "b_ ", "c"]</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>trimmer</CODE> - a <A HREF="../../../../com/google/common/base/CharMatcher.html" title="class in com.google.common.base"><CODE>CharMatcher</CODE></A> that determines whether a character
     should be removed from the beginning/end of a subsequence
<DT><B>Returns:</B><DD>a splitter with the desired configuration</DL>
</DD>
</DL>
<HR>

<A NAME="split(java.lang.CharSequence)"><!-- --></A><H3>
split</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A>&lt;<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>&gt; <B>split</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>&nbsp;sequence)</PRE>
<DL>
<DD>Splits the <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang"><CODE>CharSequence</CODE></A> passed in parameter.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>sequence</CODE> - the sequence of characters to split
<DT><B>Returns:</B><DD>an iteration over the segments split from the parameter.</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>


<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Splitter.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../com/google/common/base/Service.State.html" title="enum in com.google.common.base"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../com/google/common/base/Supplier.html" title="interface in com.google.common.base"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../index.html?com/google/common/base/Splitter.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="Splitter.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>

</BODY>
</HTML>