????
| Current Path : /opt/ant/manual/api/org/apache/tools/ant/util/ |
| Current File : //opt/ant/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 lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_03) on Tue May 22 06:24:55 CEST 2012 -->
<title>StringUtils (Apache Ant API)</title>
<meta name="date" content="2012-05-22">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="StringUtils (Apache Ant API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/tools/ant/util/StringTokenizer.html" title="class in org.apache.tools.ant.util"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/tools/ant/util/SymbolicLinkUtils.html" title="class in org.apache.tools.ant.util"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/tools/ant/util/StringUtils.html" target="_top">Frames</a></li>
<li><a href="StringUtils.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field_summary">Field</a> | </li>
<li>Constr | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field_detail">Field</a> | </li>
<li>Constr | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.tools.ant.util</div>
<h2 title="Class StringUtils" class="title">Class StringUtils</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.apache.tools.ant.util.StringUtils</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public final class <span class="strong">StringUtils</span>
extends java.lang.Object</pre>
<div class="block">A set of helper methods related to string manipulation.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/util/StringUtils.html#LINE_SEP">LINE_SEP</a></strong></code>
<div class="block">the line separator for this OS</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/util/StringUtils.html#endsWith(java.lang.StringBuffer, java.lang.String)">endsWith</a></strong>(java.lang.StringBuffer buffer,
java.lang.String suffix)</code>
<div class="block">Checks that a string buffer ends up with a given string.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/util/StringUtils.html#getStackTrace(java.lang.Throwable)">getStackTrace</a></strong>(java.lang.Throwable t)</code>
<div class="block">Convenient method to retrieve the full stacktrace from a given exception.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.util.Vector</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/util/StringUtils.html#lineSplit(java.lang.String)">lineSplit</a></strong>(java.lang.String data)</code>
<div class="block">Splits up a string into a list of lines.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static long</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/util/StringUtils.html#parseHumanSizes(java.lang.String)">parseHumanSizes</a></strong>(java.lang.String humanSize)</code>
<div class="block">Takes a human readable size representation eg 10K
a long value.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/util/StringUtils.html#removePrefix(java.lang.String, java.lang.String)">removePrefix</a></strong>(java.lang.String string,
java.lang.String prefix)</code>
<div class="block">Removes the prefix from a given string, if the string contains
that prefix.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/util/StringUtils.html#removeSuffix(java.lang.String, java.lang.String)">removeSuffix</a></strong>(java.lang.String string,
java.lang.String suffix)</code>
<div class="block">Removes the suffix from a given string, if the string contains
that suffix.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/util/StringUtils.html#replace(java.lang.String, java.lang.String, java.lang.String)">replace</a></strong>(java.lang.String data,
java.lang.String from,
java.lang.String to)</code>
<div class="block">Replace occurrences into a string.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/util/StringUtils.html#resolveBackSlash(java.lang.String)">resolveBackSlash</a></strong>(java.lang.String input)</code>
<div class="block">xml does not do "c" like interpretation of strings.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.util.Vector</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/util/StringUtils.html#split(java.lang.String, int)">split</a></strong>(java.lang.String data,
int ch)</code>
<div class="block">Splits up a string where elements are separated by a specific
character and return all elements.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="LINE_SEP">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>LINE_SEP</h4>
<pre>public static final java.lang.String LINE_SEP</pre>
<div class="block">the line separator for this OS</div>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="lineSplit(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>lineSplit</h4>
<pre>public static java.util.Vector lineSplit(java.lang.String data)</pre>
<div class="block">Splits up a string into a list of lines. It is equivalent
to <tt>split(data, '\n')</tt>.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>data</code> - the string to split up into lines.</dd>
<dt><span class="strong">Returns:</span></dt><dd>the list of lines available in the string.</dd></dl>
</li>
</ul>
<a name="split(java.lang.String, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>split</h4>
<pre>public static java.util.Vector split(java.lang.String data,
int ch)</pre>
<div class="block">Splits up a string where elements are separated by a specific
character and return all elements.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>data</code> - the string to split up.</dd><dd><code>ch</code> - the separator character.</dd>
<dt><span class="strong">Returns:</span></dt><dd>the list of elements.</dd></dl>
</li>
</ul>
<a name="replace(java.lang.String, java.lang.String, java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>replace</h4>
<pre>public static java.lang.String replace(java.lang.String data,
java.lang.String from,
java.lang.String to)</pre>
<div class="block">Replace occurrences into a string.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>data</code> - the string to replace occurrences into</dd><dd><code>from</code> - the occurrence to replace.</dd><dd><code>to</code> - the occurrence to be used as a replacement.</dd>
<dt><span class="strong">Returns:</span></dt><dd>the new string with replaced occurrences.</dd></dl>
</li>
</ul>
<a name="getStackTrace(java.lang.Throwable)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getStackTrace</h4>
<pre>public static java.lang.String getStackTrace(java.lang.Throwable t)</pre>
<div class="block">Convenient method to retrieve the full stacktrace from a given exception.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>t</code> - the exception to get the stacktrace from.</dd>
<dt><span class="strong">Returns:</span></dt><dd>the stacktrace from the given exception.</dd></dl>
</li>
</ul>
<a name="endsWith(java.lang.StringBuffer, java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>endsWith</h4>
<pre>public static boolean endsWith(java.lang.StringBuffer buffer,
java.lang.String suffix)</pre>
<div class="block">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</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>buffer</code> - the buffer to perform the check on</dd><dd><code>suffix</code> - the suffix</dd>
<dt><span class="strong">Returns:</span></dt><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.</dd></dl>
</li>
</ul>
<a name="resolveBackSlash(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>resolveBackSlash</h4>
<pre>public static java.lang.String resolveBackSlash(java.lang.String input)</pre>
<div class="block">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</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>input</code> - raw string with possible embedded '\'s</dd>
<dt><span class="strong">Returns:</span></dt><dd>converted string</dd><dt><span class="strong">Since:</span></dt>
<dd>Ant 1.7</dd></dl>
</li>
</ul>
<a name="parseHumanSizes(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>parseHumanSizes</h4>
<pre>public static long parseHumanSizes(java.lang.String humanSize)
throws java.lang.Exception</pre>
<div class="block">Takes a human readable size representation eg 10K
a long value. Doesn't support 1.1K or other rational values.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>humanSize</code> - the amount as a human readable string.</dd>
<dt><span class="strong">Returns:</span></dt><dd>a long value representation</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code> - if there is a problem.</dd><dt><span class="strong">Since:</span></dt>
<dd>Ant 1.7</dd></dl>
</li>
</ul>
<a name="removeSuffix(java.lang.String, java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>removeSuffix</h4>
<pre>public static java.lang.String removeSuffix(java.lang.String string,
java.lang.String suffix)</pre>
<div class="block">Removes the suffix from a given string, if the string contains
that suffix.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>string</code> - String for check</dd><dd><code>suffix</code> - Suffix to remove</dd>
<dt><span class="strong">Returns:</span></dt><dd>the <i>string</i> with the <i>suffix</i></dd></dl>
</li>
</ul>
<a name="removePrefix(java.lang.String, java.lang.String)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>removePrefix</h4>
<pre>public static java.lang.String removePrefix(java.lang.String string,
java.lang.String prefix)</pre>
<div class="block">Removes the prefix from a given string, if the string contains
that prefix.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>string</code> - String for check</dd><dd><code>prefix</code> - Prefix to remove</dd>
<dt><span class="strong">Returns:</span></dt><dd>the <i>string</i> with the <i>prefix</i></dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/tools/ant/util/StringTokenizer.html" title="class in org.apache.tools.ant.util"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/tools/ant/util/SymbolicLinkUtils.html" title="class in org.apache.tools.ant.util"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/tools/ant/util/StringUtils.html" target="_top">Frames</a></li>
<li><a href="StringUtils.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field_summary">Field</a> | </li>
<li>Constr | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field_detail">Field</a> | </li>
<li>Constr | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>