/usr/share/doc/libantelope-java/manual/bk03ch13.html is in libantelope-java-doc 3.5.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 13. StringUtils</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Antelope Users Guide"><link rel="up" href="bk03.html" title="Additional Ant Tasks"><link rel="prev" href="bk03ch12.html" title="Chapter 12. FileUtils"><link rel="next" href="bk03ch14.html" title="Chapter 14. UID"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 13. StringUtils</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk03ch12.html">Prev</a> </td><th width="60%" align="center">Additional Ant Tasks</th><td width="20%" align="right"> <a accesskey="n" href="bk03ch14.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="StringUtils"></a>Chapter 13. StringUtils</h1></div></div></div>
@style@
<p>
The StringUtils task provides a number of useful string manipulation functions, such as converting a string to upper or lower case, trimming white space, finding a substring, etc. <span class="bold"><strong>Caution: this task does not follow the standard Ant convention of property immutability.</strong></span>
</p><p>
To use this task in your build files, include a task definition like this:
</p><p>
</p><pre class="programlisting">
<taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask"/>
</pre><p>
</p><p>
</p><div class="table"><a name="idp62411664"></a><p class="title"><b>Table 13.1. StringUtil Task Attributes</b></p><div class="table-contents"><table summary="StringUtil Task Attributes" border="1"><colgroup><col><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Default</th><th>Required</th></tr></thead><tbody><tr><td>string</td><td>The string to manipulate.</td><td>None</td><td>No</td></tr><tr><td>property</td><td>Where to store the manipulated string. Caution: this task will overwrite any existing property with this name.</td><td>None</td><td>No</td></tr></tbody></table></div></div><p><br class="table-break">
</p><p>
Operations as nested elements:
</p><p>
</p><div class="table"><a name="idp62420976"></a><p class="title"><b>Table 13.2. indexof, lastindexof: Find the index of or the last index of a substring.</b></p><div class="table-contents"><table summary="indexof, lastindexof: Find the index of or the last index of a substring." border="1"><colgroup><col><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Default</th><th>Required</th></tr></thead><tbody><tr><td>string</td><td>The string to find the index of.</td><td>None</td><td>No</td></tr><tr><td>fromindex</td><td>Where to start looking.</td><td>0</td><td>No</td></tr></tbody></table></div></div><p><br class="table-break">
</p><div class="table"><a name="idp61203984"></a><p class="title"><b>Table 13.3. substring: Get a substring from the string.</b></p><div class="table-contents"><table summary="substring: Get a substring from the string." border="1"><colgroup><col><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Default</th><th>Required</th></tr></thead><tbody><tr><td>beginindex</td><td>Start of substring.</td><td>0</td><td>No</td></tr><tr><td>endindex</td><td>End of substring.</td><td>End of string.</td><td>No</td></tr></tbody></table></div></div><p><br class="table-break">
</p><div class="table"><a name="idp62458448"></a><p class="title"><b>Table 13.4. replace: Replace parts of the string.</b></p><div class="table-contents"><table summary="replace: Replace parts of the string." border="1"><colgroup><col><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Default</th><th>Required</th></tr></thead><tbody><tr><td>regex</td><td>Pattern to replace.</td><td>None</td><td>No</td></tr><tr><td>replacement</td><td>What to replace with.</td><td>None</td><td>No</td></tr></tbody></table></div></div><p><br class="table-break">
</p><div class="table"><a name="idp62466608"></a><p class="title"><b>Table 13.5. sort: Sort items in a string.</b></p><div class="table-contents"><table summary="sort: Sort items in a string." border="1"><colgroup><col><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Default</th><th>Required</th></tr></thead><tbody><tr><td>separator</td><td>The character separating individual items in the string.</td><td>Any of tab, new line, carriage return, line feed, or space.</td><td>No</td></tr></tbody></table></div></div><p><br class="table-break">
This is useful for sorting a comma separated list or a property value that spans several lines.
</p><p>
</p><div class="table"><a name="idp62473504"></a><p class="title"><b>Table 13.6. messagebox: Put the string in a box for nice display.</b></p><div class="table-contents"><table summary="messagebox: Put the string in a box for nice display." border="1"><colgroup><col><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Default</th><th>Required</th></tr></thead><tbody><tr><td>title</td><td>Title for the message box.</td><td>None</td><td>No</td></tr><tr><td>width</td><td>
Maximum width in characters for the message box. Lines
will be wrapped to fit inside the box. The box will not
stretch to this width if the message is less than
width - 4 characters wide.
</td><td>60</td><td>No</td></tr></tbody></table></div></div><p><br class="table-break">
</p><p>
These operations have no attributes:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
<span class="bold"><strong>lowercase</strong></span> Converts the string to lowercase.
</p></li><li class="listitem"><p>
<span class="bold"><strong>uppercase</strong></span> Converts the string to uppercase.
</p></li><li class="listitem"><p>
<span class="bold"><strong>length</strong></span> Finds the length of the string.
</p></li><li class="listitem"><p>
<span class="bold"><strong>trim</strong></span> Removes white space from boths ends of the string.
</p></li></ul></div><p>
</p><p>
More than one of the operations can be used at once, that is, you can convert a string to lowercase and trim it at the same time. See below for examples.
</p><p>
Examples:
</p><p>
Convert a string to lower case:
</p><pre class="programlisting">
<target name="test1">
<property name="prop1" value="ABCDE"/>
<echo>prop1 before = ${prop1}</echo>
<a:stringutil string="${prop1}" property="prop1">
<a:lowercase/>
</a:stringutil>
<echo>prop1 after = ${prop1}</echo>
<a:assert message="prop1, expected abcde, got ${prop1}">
<bool>
<equals arg1="abcde" arg2="${prop1}"/>
</bool>
</a:assert>
</target>
</pre><p>
</p><p>
Convert a string to upper case:
</p><pre class="programlisting">
<target name="test2">
<property name="prop2" value="abcdefgh"/>
<echo>prop2 before = ${prop2}</echo>
<a:stringutil string="${prop2}" property="prop2">
<a:uppercase/>
</a:stringutil>
<echo>prop2 after = ${prop2}</echo>
<a:assert message="prop2, expected ABCDEFGH, got ${prop2}">
<bool>
<equals arg1="ABCDEFGH" arg2="${prop2}"/>
</bool>
</a:assert>
</target>
</pre><p>
</p><p>
Convert a string to upper case and trim white space:
</p><pre class="programlisting">
<target name="test3">
<property name="prop3" value=" abcdefgh "/>
<echo>prop3 before = ${prop3}</echo>
<a:stringutil string="${prop3}" property="prop3">
<a:uppercase/>
<a:trim/>
</a:stringutil>
<echo>prop3 after = ${prop3}</echo>
<a:assert message="prop3, expected ABCDEFGH, got ${prop3}">
<bool>
<equals arg1="ABCDEFGH" arg2="${prop3}"/>
</bool>
</a:assert>
</target>
</pre><p>
</p><p>
Convert a string to upper case, trim white space, and find a substring:
</p><pre class="programlisting">
<target name="test4">
<property name="prop4" value=" abcdefgh "/>
<echo>prop4 before = ${prop4}</echo>
<a:stringutil string="${prop4}" property="prop4">
<a:uppercase/>
<a:trim/>
<a:substring beginindex="3"/>
</a:stringutil>
<echo>prop4 after = ${prop4}</echo>
<a:assert message="prop4, expected DEFGH, got ${prop4}">
<bool>
<equals arg1="DEFGH" arg2="${prop4}"/>
</bool>
</a:assert>
</target>
</pre><p>
</p><p>
Get the length of a string:
</p><pre class="programlisting">
<target name="test7">
<property name="prop7" value="abcdefgh"/>
<echo>prop7 before = ${prop7}</echo>
<a:stringutil string="${prop7}" property="prop7">
<a:length/>
</a:stringutil>
<echo>prop7 length = ${prop7}</echo>
<a:assert message="prop7, expected 8, got ${prop7}">
<bool>
<mathequals arg1="8" arg2="${prop7}"/>
</bool>
</a:assert>
</target>
</pre><p>
</p><p>
Sort a list:
</p><pre class="programlisting">
<target name="test12">
<property name="prop12" value="a,b,c,d,e,f,g,h,a,b,c,d,e,f,g,h"/>
<echo>prop12 before = ${prop12}</echo>
<a:stringutil string="${prop12}" property="prop12">
<a:sort separator=","/>
</a:stringutil>
<echo>prop12 sorted = ${prop12}</echo>
<a:assert message="prop12, expected 'a,a,b,b,c,c,d,d,e,e,f,f,g,g,h,h', got ${prop12}">
<bool>
<equals arg1="a,a,b,b,c,c,d,d,e,e,f,f,g,g,h,h" arg2="${prop12}"/>
</bool>
</a:assert>
</target>
</pre><p>
</p><p>
Message boxes:
</p><pre class="programlisting">
<target name="test13">
<property name="prop13" value="Character boundary analysis allows users to interact with characters as they expect to, for example, when moving the cursor around through a text string. Character boundary analysis provides correct navigation of through character strings, regardless of how the character is stored. For example, an accented character might be stored as a base character and a diacritical mark. What users consider to be a character can differ between languages."/>
<echo>prop13 before = ${prop13}</echo>
<a:stringutil string="${prop13}" property="prop13">
<a:messagebox/>
</a:stringutil>
<echo>prop13 in messagebox:${line.separator}${prop13}</echo>
<property name="prop13a" value="Character boundary analysis allows users to interact with characters as they expect to, for example, when moving the cursor around through a text string. Character boundary analysis provides correct navigation of through character strings, regardless of how the character is stored. For example, an accented character might be stored as a base character and a diacritical mark. What users consider to be a character can differ between languages."/>
<a:stringutil string="${prop13a}" property="prop13a">
<a:messagebox title="About Character Boundaries"/>
</a:stringutil>
<echo>prop13a in messagebox with title:${line.separator}${prop13a}</echo>
</target>
test13:
[echo] prop13 before = Character boundary analysis allows users to interact with characters as they expect to, for
example, when moving the cursor around through a text string. Character boundary analysis provides correct navigation of
through character strings, regardless of how the character is stored. For example, an accented character might be store
d as a base character and a diacritical mark. What users consider to be a character can differ between languages.
[echo] prop13 in messagebox:
[echo]
[echo] +----------------------------------------------------------------------+
[echo] | Character boundary analysis allows users to interact with characters |
[echo] | as they expect to, for example, when moving the cursor around |
[echo] | through a text string. Character boundary analysis provides correct |
[echo] | navigation of through character strings, regardless of how the |
[echo] | character is stored. For example, an accented character might |
[echo] | be stored as a base character and a diacritical mark. What users |
[echo] | consider to be a character can differ between languages. |
[echo] +----------------------------------------------------------------------+
[echo] prop13a in messagebox with title:
[echo]
[echo] +----------------------------------------------------------------------+
[echo] | About Character Boundaries |
[echo] +----------------------------------------------------------------------+
[echo] | Character boundary analysis allows users to interact with characters |
[echo] | as they expect to, for example, when moving the cursor around |
[echo] | through a text string. Character boundary analysis provides correct |
[echo] | navigation of through character strings, regardless of how the |
[echo] | character is stored. For example, an accented character might |
[echo] | be stored as a base character and a diacritical mark. What users |
[echo] | consider to be a character can differ between languages. |
[echo] +----------------------------------------------------------------------+
[antlib:ise.antelope.tasks:testcase] test13 passed.
</pre><p>
</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk03ch12.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="bk03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk03ch14.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 12. FileUtils </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 14. UID</td></tr></table></div></body></html>
|