Edit C:\apache-ant-1.8.0\docs\manual\api\org\apache\tools\ant\util\StringUtils.html
<!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.5.0_22) on Mon Feb 01 19:36:00 EST 2010 --> <TITLE> StringUtils (Apache Ant API) </TITLE> <META NAME="keywords" CONTENT="org.apache.tools.ant.util.StringUtils class"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { parent.document.title="StringUtils (Apache Ant API)"; } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <!-- ========= 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> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../org/apache/tools/ant/util/StringTokenizer.html" title="class in org.apache.tools.ant.util"><B>PREV CLASS</B></A> <A HREF="../../../../../org/apache/tools/ant/util/SymbolicLinkUtils.html" title="class in org.apache.tools.ant.util"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?org/apache/tools/ant/util/StringUtils.html" target="_top"><B>FRAMES</B></A> <A HREF="StringUtils.html" target="_top"><B>NO FRAMES</B></A> <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: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <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"> org.apache.tools.ant.util</FONT> <BR> Class StringUtils</H2> <PRE> java.lang.Object <IMG SRC="../../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.tools.ant.util.StringUtils</B> </PRE> <HR> <DL> <DT><PRE>public final class <B>StringUtils</B><DT>extends java.lang.Object</DL> </PRE> <P> A set of helper methods related to string manipulation. <P> <P> <HR> <P> <!-- =========== FIELD SUMMARY =========== --> <A NAME="field_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>Field Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/util/StringUtils.html#LINE_SEP">LINE_SEP</A></B></CODE> <BR> the line separator for this OS</TD> </TR> </TABLE> <!-- ========== 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 boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/util/StringUtils.html#endsWith(java.lang.StringBuffer, java.lang.String)">endsWith</A></B>(java.lang.StringBuffer buffer, java.lang.String suffix)</CODE> <BR> Checks that a string buffer ends up with a given string.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/util/StringUtils.html#getStackTrace(java.lang.Throwable)">getStackTrace</A></B>(java.lang.Throwable t)</CODE> <BR> Convenient method to retrieve the full stacktrace from a given exception.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static java.util.Vector</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/util/StringUtils.html#lineSplit(java.lang.String)">lineSplit</A></B>(java.lang.String data)</CODE> <BR> Splits up a string into a list of lines.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static long</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/util/StringUtils.html#parseHumanSizes(java.lang.String)">parseHumanSizes</A></B>(java.lang.String humanSize)</CODE> <BR> Takes a human readable size representation eg 10K a long value.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/util/StringUtils.html#removePrefix(java.lang.String, java.lang.String)">removePrefix</A></B>(java.lang.String string, java.lang.String prefix)</CODE> <BR> Removes the prefix from a given string, if the string contains that prefix.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/util/StringUtils.html#removeSuffix(java.lang.String, java.lang.String)">removeSuffix</A></B>(java.lang.String string, java.lang.String suffix)</CODE> <BR> Removes the suffix from a given string, if the string contains that suffix.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/util/StringUtils.html#replace(java.lang.String, java.lang.String, java.lang.String)">replace</A></B>(java.lang.String data, java.lang.String from, java.lang.String to)</CODE> <BR> Replace occurrences into a string.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/util/StringUtils.html#resolveBackSlash(java.lang.String)">resolveBackSlash</A></B>(java.lang.String input)</CODE> <BR> xml does not do "c" like interpretation of strings.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static java.util.Vector</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/util/StringUtils.html#split(java.lang.String, int)">split</A></B>(java.lang.String data, int ch)</CODE> <BR> Splits up a string where elements are separated by a specific character and return all elements.</TD> </TR> </TABLE> <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.Object</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD> </TR> </TABLE> <P> <!-- ============ FIELD DETAIL =========== --> <A NAME="field_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>Field Detail</B></FONT></TH> </TR> </TABLE> <A NAME="LINE_SEP"><!-- --></A><H3> LINE_SEP</H3> <PRE> public static final java.lang.String <B>LINE_SEP</B></PRE> <DL> <DD>the line separator for this OS <P> <DL> </DL> </DL> <!-- ============ 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="lineSplit(java.lang.String)"><!-- --></A><H3> lineSplit</H3> <PRE> public static java.util.Vector <B>lineSplit</B>(java.lang.String data)</PRE> <DL> <DD>Splits up a string into a list of lines. It is equivalent to <tt>split(data, '\n')</tt>. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>data</CODE> - the string to split up into lines. <DT><B>Returns:</B><DD>the list of lines available in the string.</DL> </DD> </DL> <HR> <A NAME="split(java.lang.String, int)"><!-- --></A><H3> split</H3> <PRE> public static java.util.Vector <B>split</B>(java.lang.String data, int ch)</PRE> <DL> <DD>Splits up a string where elements are separated by a specific character and return all elements. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>data</CODE> - the string to split up.<DD><CODE>ch</CODE> - the separator character. <DT><B>Returns:</B><DD>the list of elements.</DL> </DD> </DL> <HR> <A NAME="replace(java.lang.String, java.lang.String, java.lang.String)"><!-- --></A><H3> replace</H3> <PRE> public static java.lang.String <B>replace</B>(java.lang.String data, java.lang.String from, java.lang.String to)</PRE> <DL> <DD>Replace occurrences into a string. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>data</CODE> - the string to replace occurrences into<DD><CODE>from</CODE> - the occurrence to replace.<DD><CODE>to</CODE> - the occurrence to be used as a replacement. <DT><B>Returns:</B><DD>the new string with replaced occurrences.</DL> </DD> </DL> <HR> <A NAME="getStackTrace(java.lang.Throwable)"><!-- --></A><H3> getStackTrace</H3> <PRE> public static java.lang.String <B>getStackTrace</B>(java.lang.Throwable t)</PRE> <DL> <DD>Convenient method to retrieve the full stacktrace from a given exception. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>t</CODE> - the exception to get the stacktrace from. <DT><B>Returns:</B><DD>the stacktrace from the given exception.</DL> </DD> </DL> <HR> <A NAME="endsWith(java.lang.StringBuffer, java.lang.String)"><!-- --></A><H3> endsWith</H3> <PRE> public static boolean <B>endsWith</B>(java.lang.StringBuffer buffer, java.lang.String suffix)</PRE> <DL> <DD>Checks that a string buffer ends up with a given string. It may sound trivial with the existing JDK API but the various implementation among JDKs can make those methods extremely resource intensive and perform poorly due to massive memory allocation and copying. See <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>buffer</CODE> - the buffer to perform the check on<DD><CODE>suffix</CODE> - the suffix <DT><B>Returns:</B><DD><code>true</code> if the character sequence represented by the argument is a suffix of the character sequence represented by the StringBuffer object; <code>false</code> otherwise. Note that the result will be <code>true</code> if the argument is the empty string.</DL> </DD> </DL> <HR> <A NAME="resolveBackSlash(java.lang.String)"><!-- --></A><H3> resolveBackSlash</H3> <PRE> public static java.lang.String <B>resolveBackSlash</B>(java.lang.String input)</PRE> <DL> <DD>xml does not do "c" like interpretation of strings. i.e. \n\r\t etc. this method processes \n, \r, \t, \f, \\ also subs \s -> " \n\r\t\f" a trailing '\' will be ignored <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>input</CODE> - raw string with possible embedded '\'s <DT><B>Returns:</B><DD>converted string<DT><B>Since:</B></DT> <DD>Ant 1.7</DD> </DL> </DD> </DL> <HR> <A NAME="parseHumanSizes(java.lang.String)"><!-- --></A><H3> parseHumanSizes</H3> <PRE> public static long <B>parseHumanSizes</B>(java.lang.String humanSize) throws java.lang.Exception</PRE> <DL> <DD>Takes a human readable size representation eg 10K a long value. Doesn't support 1.1K or other rational values. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>humanSize</CODE> - the amount as a human readable string. <DT><B>Returns:</B><DD>a long value representation <DT><B>Throws:</B> <DD><CODE>java.lang.Exception</CODE> - if there is a problem.<DT><B>Since:</B></DT> <DD>Ant 1.7</DD> </DL> </DD> </DL> <HR> <A NAME="removeSuffix(java.lang.String, java.lang.String)"><!-- --></A><H3> removeSuffix</H3> <PRE> public static java.lang.String <B>removeSuffix</B>(java.lang.String string, java.lang.String suffix)</PRE> <DL> <DD>Removes the suffix from a given string, if the string contains that suffix. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>string</CODE> - String for check<DD><CODE>suffix</CODE> - Suffix to remove <DT><B>Returns:</B><DD>the <i>string</i> with the <i>suffix</i></DL> </DD> </DL> <HR> <A NAME="removePrefix(java.lang.String, java.lang.String)"><!-- --></A><H3> removePrefix</H3> <PRE> public static java.lang.String <B>removePrefix</B>(java.lang.String string, java.lang.String prefix)</PRE> <DL> <DD>Removes the prefix from a given string, if the string contains that prefix. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>string</CODE> - String for check<DD><CODE>prefix</CODE> - Prefix to remove <DT><B>Returns:</B><DD>the <i>string</i> with the <i>prefix</i></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> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../org/apache/tools/ant/util/StringTokenizer.html" title="class in org.apache.tools.ant.util"><B>PREV CLASS</B></A> <A HREF="../../../../../org/apache/tools/ant/util/SymbolicLinkUtils.html" title="class in org.apache.tools.ant.util"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?org/apache/tools/ant/util/StringUtils.html" target="_top"><B>FRAMES</B></A> <A HREF="StringUtils.html" target="_top"><B>NO FRAMES</B></A> <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: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de