| <!DOCTYPE HTML> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (21) on Thu Oct 05 19:54:57 CEST 2023 --> |
| <title>CharSequences (Apache SIS 1.4 API)</title> |
| <meta name="viewport" content="width=device-width, initial-scale=1"> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <meta name="dc.created" content="2023-10-05"> |
| <meta name="description" content="declaration: module: org.apache.sis.util, package: org.apache.sis.util, class: CharSequences"> |
| <meta name="generator" content="javadoc/ClassWriterImpl"> |
| <meta name="keywords" content="org.apache.sis.util.CharSequences class"> |
| <meta name="keywords" content="EMPTY_ARRAY"> |
| <meta name="keywords" content="spaces()"> |
| <meta name="keywords" content="length()"> |
| <meta name="keywords" content="codePointCount()"> |
| <meta name="keywords" content="count()"> |
| <meta name="keywords" content="indexOf()"> |
| <meta name="keywords" content="lastIndexOf()"> |
| <meta name="keywords" content="indexOfLineStart()"> |
| <meta name="keywords" content="skipLeadingWhitespaces()"> |
| <meta name="keywords" content="skipTrailingWhitespaces()"> |
| <meta name="keywords" content="split()"> |
| <meta name="keywords" content="splitOnEOL()"> |
| <meta name="keywords" content="parseDoubles()"> |
| <meta name="keywords" content="parseFloats()"> |
| <meta name="keywords" content="parseLongs()"> |
| <meta name="keywords" content="parseInts()"> |
| <meta name="keywords" content="parseShorts()"> |
| <meta name="keywords" content="parseBytes()"> |
| <meta name="keywords" content="toASCII()"> |
| <meta name="keywords" content="trimWhitespaces()"> |
| <meta name="keywords" content="trimFractionalPart()"> |
| <meta name="keywords" content="shortSentence()"> |
| <meta name="keywords" content="upperCaseToSentence()"> |
| <meta name="keywords" content="camelCaseToSentence()"> |
| <meta name="keywords" content="camelCaseToWords()"> |
| <meta name="keywords" content="camelCaseToAcronym()"> |
| <meta name="keywords" content="isAcronymForWords()"> |
| <meta name="keywords" content="isUnicodeIdentifier()"> |
| <meta name="keywords" content="isUpperCase()"> |
| <meta name="keywords" content="equalsFiltered()"> |
| <meta name="keywords" content="equalsIgnoreCase()"> |
| <meta name="keywords" content="equals()"> |
| <meta name="keywords" content="regionMatches()"> |
| <meta name="keywords" content="startsWith()"> |
| <meta name="keywords" content="endsWith()"> |
| <meta name="keywords" content="commonPrefix()"> |
| <meta name="keywords" content="commonSuffix()"> |
| <meta name="keywords" content="commonWords()"> |
| <meta name="keywords" content="token()"> |
| <meta name="keywords" content="replace()"> |
| <meta name="keywords" content="copyChars()"> |
| <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../../sis.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../../script-dir/jquery-ui.min.css" title="Style"> |
| <script type="text/javascript" src="../../../../../script.js"></script> |
| <script type="text/javascript" src="../../../../../script-dir/jquery-3.6.1.min.js"></script> |
| <script type="text/javascript" src="../../../../../script-dir/jquery-ui.min.js"></script> |
| </head> |
| <body class="class-declaration-page"> |
| <script type="text/javascript">var pathtoroot = "../../../../../"; |
| loadScripts(document, 'script');</script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <div class="flex-box"> |
| <header role="banner" class="flex-header"> |
| <nav role="navigation"> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="top-nav" id="navbar-top"><button id="navbar-toggle-button" aria-controls="navbar-top" aria-expanded="false" aria-label="Toggle navigation links"><span class="nav-bar-toggle-icon"> </span><span class="nav-bar-toggle-icon"> </span><span class="nav-bar-toggle-icon"> </span></button> |
| <div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div> |
| <ul id="navbar-top-firstrow" class="nav-list" title="Navigation"> |
| <li><a href="../../../../../index.html">Overview</a></li> |
| <li><a href="../../../../module-summary.html">Module</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="nav-bar-cell1-rev">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#class">Help</a></li> |
| </ul> |
| <ul class="sub-nav-list-small"> |
| <li> |
| <p>Summary:</p> |
| <ul> |
| <li>Nested</li> |
| <li><a href="#field-summary">Field</a></li> |
| <li>Constr</li> |
| <li><a href="#method-summary">Method</a></li> |
| </ul> |
| </li> |
| <li> |
| <p>Detail:</p> |
| <ul> |
| <li><a href="#field-detail">Field</a></li> |
| <li>Constr</li> |
| <li><a href="#method-detail">Method</a></li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="sub-nav"> |
| <div id="navbar-sub-list"> |
| <ul class="sub-nav-list"> |
| <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="sub-nav-list"> |
| <li>Detail: </li> |
| <li><a href="#field-detail">Field</a> | </li> |
| <li>Constr | </li> |
| <li><a href="#method-detail">Method</a></li> |
| </ul> |
| </div> |
| <div class="nav-list-search"><a href="../../../../../search.html">SEARCH</a> |
| <input type="text" id="search-input" disabled placeholder="Search"> |
| <input type="reset" id="reset-button" disabled value="reset"> |
| </div> |
| </div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <span class="skip-nav" id="skip-navbar-top"></span></nav> |
| </header> |
| <div class="flex-content"> |
| <main role="main"> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="sub-title"><span class="module-label-in-type">Module</span> <a href="../../../../module-summary.html">org.apache.sis.util</a></div> |
| <div class="sub-title"><span class="package-label-in-type">Package</span> <a href="package-summary.html">org.apache.sis.util</a></div> |
| <h1 title="Class CharSequences" class="title">Class CharSequences</h1> |
| </div> |
| <div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a> |
| <div class="inheritance"><a href="Static.html" title="class in org.apache.sis.util">Static</a> |
| <div class="inheritance">CharSequences</div> |
| </div> |
| </div> |
| <section class="class-description" id="class-description"> |
| <hr> |
| <div class="type-signature"><span class="modifiers">public final class </span><span class="element-name type-name-label">CharSequences</span> |
| <span class="extends-implements">extends <a href="Static.html" title="class in org.apache.sis.util">Static</a></span></div> |
| <div class="block">Static methods working with <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link"><code>CharSequence</code></a> instances. Some methods defined in this |
| class duplicate the functionalities already provided in the standard <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link"><code>String</code></a> class, |
| but works on a generic <code>CharSequence</code> instance instead of <code>String</code>. |
| |
| <h2 id="unicode-support-heading">Unicode support</h2> |
| Every methods defined in this class work on <cite>code points</cite> instead of characters |
| when appropriate. Consequently, those methods should behave correctly with characters outside |
| the <cite>Basic Multilingual Plane</cite> (BMP). |
| |
| <h2 id="policy-on-space-characters-heading">Policy on space characters</h2> |
| Java defines two methods for testing if a character is a white space: |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#isWhitespace(int)" title="class or interface in java.lang" class="external-link"><code>Character.isWhitespace(int)</code></a> and <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#isSpaceChar(int)" title="class or interface in java.lang" class="external-link"><code>Character.isSpaceChar(int)</code></a>. |
| Those two methods differ in the way they handle <a href="Characters.html#NO_BREAK_SPACE">no-break spaces</a>, tabulations and line feeds. The general policy in the SIS library is: |
| |
| <ul> |
| <li>Use <code>isWhitespace(…)</code> when separating entities (words, numbers, tokens, <i>etc.</i>) |
| in a list. Using that method, characters separated by a no-break space are considered as |
| part of the same entity.</li> |
| <li>Use <code>isSpaceChar(…)</code> when parsing a single entity, for example a single word. |
| Using this method, no-break spaces are considered as part of the entity while line |
| feeds or tabulations are entity boundaries.</li> |
| </ul> |
| |
| For example numbers formatted in the French locale use no-break spaces as group separators. |
| When parsing a list of numbers, ordinary spaces around the numbers may need to be ignored, |
| but no-break spaces shall be considered as part of the numbers. |
| Consequently, <code>isWhitespace(…)</code> is appropriate for skipping spaces <em>between</em> the numbers. |
| But if there is spaces to skip <em>inside</em> a single number, then <code>isSpaceChar(…)</code> is a good choice |
| for accepting no-break spaces and for stopping the parse operation at tabulations or line feed character. |
| A tabulation or line feed between two characters is very likely to separate two distinct values. |
| |
| In practice, the <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/text/Format.html" title="class or interface in java.text" class="external-link"><code>Format</code></a> implementations in the SIS library typically use |
| <code>isSpaceChar(…)</code> while most of the rest of the SIS library, including this |
| <code>CharSequences</code> class, consistently uses <code>isWhitespace(…)</code>. |
| |
| <p>Note that the <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#trim()" title="class or interface in java.lang" class="external-link"><code>String.trim()</code></a> method doesn't follow any of those policies and should |
| generally be avoided. That <code>trim()</code> method removes every ISO control characters without |
| distinction about whether the characters are space or not, and ignore all Unicode spaces. |
| The <a href="#trimWhitespaces(java.lang.String)"><code>trimWhitespaces(String)</code></a> method defined in this class can be used as an alternative.</p> |
| |
| <h2 id="handling-of-null-values-heading">Handling of null values</h2> |
| Most methods in this class accept a <code>null</code> <code>CharSequence</code> argument. In such cases |
| the method return value is either a <code>null</code> <code>CharSequence</code>, an empty array, or a |
| <code>0</code> or <code>false</code> primitive type calculated as if the input was an empty string.</div> |
| <dl class="notes"> |
| <dt>Since:</dt> |
| <dd>0.3</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list"> |
| <li><a href="StringBuilders.html" title="class in org.apache.sis.util"><code>StringBuilders</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| <section class="summary"> |
| <ul class="summary-list"> |
| <!-- =========== FIELD SUMMARY =========== --> |
| <li> |
| <section class="field-summary" id="field-summary"> |
| <h2>Field Summary</h2> |
| <div class="caption"><span>Fields</span></div> |
| <div class="summary-table three-column-summary"> |
| <div class="table-header col-first">Modifier and Type</div> |
| <div class="table-header col-second">Field</div> |
| <div class="table-header col-last">Description</div> |
| <div class="col-first even-row-color"><code>static final <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>[]</code></div> |
| <div class="col-second even-row-color"><code><a href="#EMPTY_ARRAY" class="member-name-link">EMPTY_ARRAY</a></code></div> |
| <div class="col-last even-row-color"> |
| <div class="block">An array of zero-length.</div> |
| </div> |
| </div> |
| </section> |
| </li> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <li> |
| <section class="method-summary" id="method-summary"> |
| <h2>Method Summary</h2> |
| <div id="method-summary-table"> |
| <div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab1" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab1', 3)" class="table-tab">Static Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button><button id="method-summary-table-tab6" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab6', 3)" class="table-tab">Deprecated Methods</button></div> |
| <div id="method-summary-table.tabpanel" role="tabpanel"> |
| <div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0"> |
| <div class="table-header col-first">Modifier and Type</div> |
| <div class="table-header col-second">Method</div> |
| <div class="table-header col-last">Description</div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#camelCaseToAcronym(java.lang.CharSequence)" class="member-name-link">camelCaseToAcronym</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Creates an acronym from the given text.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#camelCaseToSentence(java.lang.CharSequence)" class="member-name-link">camelCaseToSentence</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> identifier)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Given a string in camel cases (typically an identifier), returns a string formatted |
| like an English sentence.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#camelCaseToWords(java.lang.CharSequence,boolean)" class="member-name-link">camelCaseToWords</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> identifier, |
| boolean toLowerCase)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Given a string in camel cases, returns a string with the same words separated by spaces.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static int</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#codePointCount(java.lang.CharSequence)" class="member-name-link">codePointCount</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns the number of Unicode code points in the given characters sequence, |
| or 0 if <code>null</code>.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static int</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#codePointCount(java.lang.CharSequence,int,int)" class="member-name-link">codePointCount</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| int fromIndex, |
| int toIndex)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns the number of Unicode code points in the given characters sub-sequence, |
| or 0 if <code>null</code>.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#commonPrefix(java.lang.CharSequence,java.lang.CharSequence)" class="member-name-link">commonPrefix</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> s1, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> s2)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns the longest sequence of characters which is found at the beginning of the two given texts.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#commonSuffix(java.lang.CharSequence,java.lang.CharSequence)" class="member-name-link">commonSuffix</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> s1, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> s2)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns the longest sequence of characters which is found at the end of the two given texts.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#commonWords(java.lang.CharSequence,java.lang.CharSequence)" class="member-name-link">commonWords</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> s1, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> s2)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns the words found at the beginning and end of both texts.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static void</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#copyChars(java.lang.CharSequence,int,char%5B%5D,int,int)" class="member-name-link">copyChars</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> src, |
| int srcOffset, |
| char[] dst, |
| int dstOffset, |
| int length)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Copies a sequence of characters in the given <code>char[]</code> array.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static int</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#count(java.lang.CharSequence,char)" class="member-name-link">count</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| char toSearch)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Counts the number of occurrence of the given character in the given character sequence.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static int</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#count(java.lang.CharSequence,java.lang.String)" class="member-name-link">count</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> toSearch)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns the number of occurrences of the <code>toSearch</code> string in the given <code>text</code>.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static boolean</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#endsWith(java.lang.CharSequence,java.lang.CharSequence,boolean)" class="member-name-link">endsWith</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> suffix, |
| boolean ignoreCase)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns <code>true</code> if the given character sequence ends with the given suffix.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static boolean</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#equals(java.lang.CharSequence,java.lang.CharSequence)" class="member-name-link">equals</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> s1, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> s2)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns <code>true</code> if the two given texts are equal.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static boolean</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#equalsFiltered(java.lang.CharSequence,java.lang.CharSequence,org.apache.sis.util.Characters.Filter,boolean)" class="member-name-link">equalsFiltered</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> s1, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> s2, |
| <a href="Characters.Filter.html" title="class in org.apache.sis.util">Characters.Filter</a> filter, |
| boolean ignoreCase)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns <code>true</code> if the given texts are equal, optionally ignoring case and filtered-out characters.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static boolean</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#equalsIgnoreCase(java.lang.CharSequence,java.lang.CharSequence)" class="member-name-link">equalsIgnoreCase</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> s1, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> s2)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns <code>true</code> if the two given texts are equal, ignoring case.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static int</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#indexOf(java.lang.CharSequence,int,int,int)" class="member-name-link">indexOf</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| int toSearch, |
| int fromIndex, |
| int toIndex)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns the index within the given character sequence of the first occurrence of the |
| specified character, starting the search at the specified index.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static int</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#indexOf(java.lang.CharSequence,java.lang.CharSequence,int,int)" class="member-name-link">indexOf</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> toSearch, |
| int fromIndex, |
| int toIndex)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns the index within the given strings of the first occurrence of the specified part, |
| starting at the specified index.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static int</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#indexOfLineStart(java.lang.CharSequence,int,int)" class="member-name-link">indexOfLineStart</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| int numLines, |
| int fromIndex)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns the index of the first character after the given number of lines.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static boolean</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#isAcronymForWords(java.lang.CharSequence,java.lang.CharSequence)" class="member-name-link">isAcronymForWords</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> acronym, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> words)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns <code>true</code> if the first string is likely to be an acronym of the second string.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static boolean</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#isUnicodeIdentifier(java.lang.CharSequence)" class="member-name-link">isUnicodeIdentifier</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> identifier)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns <code>true</code> if the given identifier is a legal Unicode identifier.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static boolean</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#isUpperCase(java.lang.CharSequence)" class="member-name-link">isUpperCase</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns <code>true</code> if the given text is non-null, contains at least one upper-case character and |
| no lower-case character.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static int</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#lastIndexOf(java.lang.CharSequence,int,int,int)" class="member-name-link">lastIndexOf</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| int toSearch, |
| int fromIndex, |
| int toIndex)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns the index within the given character sequence of the last occurrence of the |
| specified character, searching backward in the given index range.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static int</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#length(java.lang.CharSequence)" class="member-name-link">length</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns the <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html#length()" title="class or interface in java.lang" class="external-link">length</a> of the given characters sequence, |
| or 0 if <code>null</code>.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static byte[]</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#parseBytes(java.lang.CharSequence,char,int)" class="member-name-link">parseBytes</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> values, |
| char separator, |
| int radix)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block"><a href="#split(java.lang.CharSequence,char)">Splits</a> the given text around the given character, |
| then <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Byte.html#parseByte(java.lang.String)" title="class or interface in java.lang" class="external-link">parses</a> each item as a <code>byte</code>.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static double[]</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#parseDoubles(java.lang.CharSequence,char)" class="member-name-link">parseDoubles</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> values, |
| char separator)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block"><a href="#split(java.lang.CharSequence,char)">Splits</a> the given text around the given character, |
| then <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#parseDouble(java.lang.String)" title="class or interface in java.lang" class="external-link">parses</a> each item as a <code>double</code>.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static float[]</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#parseFloats(java.lang.CharSequence,char)" class="member-name-link">parseFloats</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> values, |
| char separator)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block"><a href="#split(java.lang.CharSequence,char)">Splits</a> the given text around the given character, |
| then <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Float.html#parseFloat(java.lang.String)" title="class or interface in java.lang" class="external-link">parses</a> each item as a <code>float</code>.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static int[]</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#parseInts(java.lang.CharSequence,char,int)" class="member-name-link">parseInts</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> values, |
| char separator, |
| int radix)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block"><a href="#split(java.lang.CharSequence,char)">Splits</a> the given text around the given character, |
| then <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Integer.html#parseInt(java.lang.String)" title="class or interface in java.lang" class="external-link">parses</a> each item as an <code>int</code>.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static long[]</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#parseLongs(java.lang.CharSequence,char,int)" class="member-name-link">parseLongs</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> values, |
| char separator, |
| int radix)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block"><a href="#split(java.lang.CharSequence,char)">Splits</a> the given text around the given character, |
| then <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Long.html#parseLong(java.lang.String)" title="class or interface in java.lang" class="external-link">parses</a> each item as a <code>long</code>.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static short[]</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#parseShorts(java.lang.CharSequence,char,int)" class="member-name-link">parseShorts</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> values, |
| char separator, |
| int radix)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block"><a href="#split(java.lang.CharSequence,char)">Splits</a> the given text around the given character, |
| then <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Short.html#parseShort(java.lang.String)" title="class or interface in java.lang" class="external-link">parses</a> each item as a <code>short</code>.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static boolean</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#regionMatches(java.lang.CharSequence,int,java.lang.CharSequence)" class="member-name-link">regionMatches</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| int fromIndex, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> part)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns <code>true</code> if the given text at the given offset contains the given part, |
| in a case-sensitive comparison.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static boolean</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#regionMatches(java.lang.CharSequence,int,java.lang.CharSequence,boolean)" class="member-name-link">regionMatches</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| int fromIndex, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> part, |
| boolean ignoreCase)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns <code>true</code> if the given text at the given offset contains the given part, |
| optionally in a case-insensitive way.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#replace(java.lang.CharSequence,java.lang.CharSequence,java.lang.CharSequence)" class="member-name-link">replace</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> toSearch, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> replaceBy)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Replaces all occurrences of a given string in the given character sequence.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#shortSentence(java.lang.CharSequence,int)" class="member-name-link">shortSentence</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| int maxLength)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Makes sure that the <code>text</code> string is not longer than <code>maxLength</code> characters.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static int</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#skipLeadingWhitespaces(java.lang.CharSequence,int,int)" class="member-name-link">skipLeadingWhitespaces</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| int fromIndex, |
| int toIndex)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns the index of the first non-white character in the given range.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static int</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#skipTrailingWhitespaces(java.lang.CharSequence,int,int)" class="member-name-link">skipTrailingWhitespaces</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| int fromIndex, |
| int toIndex)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns the index <em>after</em> the last non-white character in the given range.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#spaces(int)" class="member-name-link">spaces</a><wbr>(int length)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns a character sequence of the specified length filled with white spaces.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a>[]</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#split(java.lang.CharSequence,char)" class="member-name-link">split</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| char separator)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Splits a text around the given character.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a>[]</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#splitOnEOL(java.lang.CharSequence)" class="member-name-link">splitOnEOL</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Splits a text around the <cite>End Of Line</cite> (EOL) characters.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static boolean</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#startsWith(java.lang.CharSequence,java.lang.CharSequence,boolean)" class="member-name-link">startsWith</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> prefix, |
| boolean ignoreCase)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns <code>true</code> if the given character sequence starts with the given prefix.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#toASCII(java.lang.CharSequence)" class="member-name-link">toASCII</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Replaces some Unicode characters by ASCII characters on a "best effort basis".</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#token(java.lang.CharSequence,int)" class="member-name-link">token</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| int fromIndex)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns the token starting at the given offset in the given text.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#trimFractionalPart(java.lang.CharSequence)" class="member-name-link">trimFractionalPart</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> value)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Trims the fractional part of the given formatted number, provided that it doesn't change |
| the value.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#trimWhitespaces(java.lang.CharSequence)" class="member-name-link">trimWhitespaces</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns a text with leading and trailing whitespace characters omitted.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#trimWhitespaces(java.lang.CharSequence,int,int)" class="member-name-link">trimWhitespaces</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| int lower, |
| int upper)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns a sub-sequence with leading and trailing whitespace characters omitted.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4 method-summary-table-tab6"><code>static <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4 method-summary-table-tab6"><code><a href="#trimWhitespaces(java.lang.String)" class="member-name-link">trimWhitespaces</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> text)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4 method-summary-table-tab6"> |
| <div class="block"><span class="deprecated-label">Deprecated, for removal: This API element is subject to removal in a future version.</span> |
| <div class="deprecation-comment">Replaced by <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#strip()" title="class or interface in java.lang" class="external-link"><code>String.strip()</code></a> in JDK 11.</div> |
| </div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#upperCaseToSentence(java.lang.CharSequence)" class="member-name-link">upperCaseToSentence</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> identifier)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Given a string in upper cases (typically a Java constant), returns a string formatted |
| like an English sentence.</div> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="inherited-list"> |
| <h3 id="methods-inherited-from-class-Object">Methods inherited from class <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></h3> |
| <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#clone()" title="class or interface in java.lang" class="external-link">clone</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#finalize()" title="class or interface in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">getClass</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hashCode</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notifyAll</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">toString</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div> |
| </section> |
| </li> |
| </ul> |
| </section> |
| <section class="details"> |
| <ul class="details-list"> |
| <!-- ============ FIELD DETAIL =========== --> |
| <li> |
| <section class="field-details" id="field-detail"> |
| <h2>Field Details</h2> |
| <ul class="member-list"> |
| <li> |
| <section class="detail" id="EMPTY_ARRAY"> |
| <h3>EMPTY_ARRAY</h3> |
| <div class="member-signature"><span class="modifiers">public static final</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>[]</span> <span class="element-name">EMPTY_ARRAY</span></div> |
| <div class="block">An array of zero-length. This constant play a role equivalents to |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Collections.html#EMPTY_LIST" title="class or interface in java.util" class="external-link"><code>Collections.EMPTY_LIST</code></a>.</div> |
| </section> |
| </li> |
| </ul> |
| </section> |
| </li> |
| <!-- ============ METHOD DETAIL ========== --> |
| <li> |
| <section class="method-details" id="method-detail"> |
| <h2>Method Details</h2> |
| <ul class="member-list"> |
| <li> |
| <section class="detail" id="spaces(int)"> |
| <h3>spaces</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></span> <span class="element-name">spaces</span><wbr><span class="parameters">(int length)</span></div> |
| <div class="block">Returns a character sequence of the specified length filled with white spaces. |
| |
| <h4 id="use-case-heading">Use case</h4> |
| This method is typically invoked for performing right-alignment of text on the |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/Console.html" title="class or interface in java.io" class="external-link">console</a> or other device using monospaced font. |
| Callers compute a value for the <code>length</code> argument by (<var>desired width</var> - <var>used width</var>). |
| Since the <var>used width</var> value may be greater than expected, this method handle negative <code>length</code> |
| values as if the value was zero.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>length</code> - the string length. Negative values are clamped to 0.</dd> |
| <dt>Returns:</dt> |
| <dd>a string of length <code>length</code> filled with white spaces.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="length(java.lang.CharSequence)"> |
| <h3>length</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">int</span> <span class="element-name">length</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text)</span></div> |
| <div class="block">Returns the <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html#length()" title="class or interface in java.lang" class="external-link">length</a> of the given characters sequence, |
| or 0 if <code>null</code>.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the character sequence from which to get the length, or <code>null</code>.</dd> |
| <dt>Returns:</dt> |
| <dd>the length of the character sequence, or 0 if the argument is <code>null</code>.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="codePointCount(java.lang.CharSequence)"> |
| <h3>codePointCount</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">int</span> <span class="element-name">codePointCount</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text)</span></div> |
| <div class="block">Returns the number of Unicode code points in the given characters sequence, |
| or 0 if <code>null</code>. Unpaired surrogates within the text count as one code |
| point each.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the character sequence from which to get the count, or <code>null</code>.</dd> |
| <dt>Returns:</dt> |
| <dd>the number of Unicode code points, or 0 if the argument is <code>null</code>.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="#codePointCount(java.lang.CharSequence,int,int)"><code>codePointCount(CharSequence, int, int)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="codePointCount(java.lang.CharSequence,int,int)"> |
| <h3>codePointCount</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">int</span> <span class="element-name">codePointCount</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| int fromIndex, |
| int toIndex)</span></div> |
| <div class="block">Returns the number of Unicode code points in the given characters sub-sequence, |
| or 0 if <code>null</code>. Unpaired surrogates within the text count as one code |
| point each. |
| |
| <p>This method performs the same work than the standard |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#codePointCount(java.lang.CharSequence,int,int)" title="class or interface in java.lang" class="external-link"><code>Character.codePointCount(CharSequence, int, int)</code></a> method, except that it tries |
| to delegate to the optimized methods from the <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link"><code>String</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/StringBuilder.html" title="class or interface in java.lang" class="external-link"><code>StringBuilder</code></a>, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/StringBuffer.html" title="class or interface in java.lang" class="external-link"><code>StringBuffer</code></a> or <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/CharBuffer.html" title="class or interface in java.nio" class="external-link"><code>CharBuffer</code></a> classes if possible.</p></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the character sequence from which to get the count, or <code>null</code>.</dd> |
| <dd><code>fromIndex</code> - the index from which to start the computation.</dd> |
| <dd><code>toIndex</code> - the index after the last character to take in account.</dd> |
| <dt>Returns:</dt> |
| <dd>the number of Unicode code points, or 0 if the argument is <code>null</code>.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#codePointCount(java.lang.CharSequence,int,int)" title="class or interface in java.lang" class="external-link"><code>Character.codePointCount(CharSequence, int, int)</code></a></li> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#codePointCount(int,int)" title="class or interface in java.lang" class="external-link"><code>String.codePointCount(int, int)</code></a></li> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/StringBuilder.html#codePointCount(int,int)" title="class or interface in java.lang" class="external-link"><code>StringBuilder.codePointCount(int, int)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="count(java.lang.CharSequence,java.lang.String)"> |
| <h3>count</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">int</span> <span class="element-name">count</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> toSearch)</span></div> |
| <div class="block">Returns the number of occurrences of the <code>toSearch</code> string in the given <code>text</code>. |
| The search is case-sensitive.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the character sequence to count occurrences, or <code>null</code>.</dd> |
| <dd><code>toSearch</code> - the string to search in the given <code>text</code>. |
| It shall contain at least one character.</dd> |
| <dt>Returns:</dt> |
| <dd>the number of occurrences of <code>toSearch</code> in <code>text</code>, |
| or 0 if <code>text</code> was null or empty.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if the <code>toSearch</code> argument is null.</dd> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></code> - if the <code>toSearch</code> argument is empty.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="count(java.lang.CharSequence,char)"> |
| <h3>count</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">int</span> <span class="element-name">count</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| char toSearch)</span></div> |
| <div class="block">Counts the number of occurrence of the given character in the given character sequence.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the character sequence to count occurrences, or <code>null</code>.</dd> |
| <dd><code>toSearch</code> - the character to count.</dd> |
| <dt>Returns:</dt> |
| <dd>the number of occurrences of the given character, or 0 if the <code>text</code> is null.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="indexOf(java.lang.CharSequence,java.lang.CharSequence,int,int)"> |
| <h3>indexOf</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">int</span> <span class="element-name">indexOf</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> toSearch, |
| int fromIndex, |
| int toIndex)</span></div> |
| <div class="block">Returns the index within the given strings of the first occurrence of the specified part, |
| starting at the specified index. This method is equivalent to the following method call, |
| except that this method works on arbitrary <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link"><code>CharSequence</code></a> objects instead of |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link"><code>String</code></a>s only, and that the upper limit can be specified: |
| |
| |
| <div class="snippet-container"><button class="copy snippet-copy" aria-label="Copy snippet" onclick="copySnippet(this)"><span data-copied="Copied!">Copy</span><img src="../../../../../copy.svg" alt="Copy snippet"></button> |
| <pre class="snippet"><code class="language-java">return text.indexOf(part, fromIndex); |
| </code></pre> |
| </div> |
| |
| |
| There is no restriction on the value of <code>fromIndex</code>. If negative or greater |
| than <code>toIndex</code>, then the behavior of this method is as if the search started |
| from 0 or <code>toIndex</code> respectively. This is consistent with the |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#indexOf(java.lang.String,int)" title="class or interface in java.lang" class="external-link"><code>String.indexOf(String, int)</code></a> behavior.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the string in which to perform the search.</dd> |
| <dd><code>toSearch</code> - the substring for which to search.</dd> |
| <dd><code>fromIndex</code> - the index from which to start the search.</dd> |
| <dd><code>toIndex</code> - the index after the last character where to perform the search.</dd> |
| <dt>Returns:</dt> |
| <dd>the index within the text of the first occurrence of the specified part, starting at the specified index, |
| or -1 if no occurrence has been found or if the <code>text</code> argument is null.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if the <code>toSearch</code> argument is null.</dd> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></code> - if the <code>toSearch</code> argument is empty.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#indexOf(java.lang.String,int)" title="class or interface in java.lang" class="external-link"><code>String.indexOf(String, int)</code></a></li> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/StringBuilder.html#indexOf(java.lang.String,int)" title="class or interface in java.lang" class="external-link"><code>StringBuilder.indexOf(String, int)</code></a></li> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/StringBuffer.html#indexOf(java.lang.String,int)" title="class or interface in java.lang" class="external-link"><code>StringBuffer.indexOf(String, int)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="indexOf(java.lang.CharSequence,int,int,int)"> |
| <h3>indexOf</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">int</span> <span class="element-name">indexOf</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| int toSearch, |
| int fromIndex, |
| int toIndex)</span></div> |
| <div class="block">Returns the index within the given character sequence of the first occurrence of the |
| specified character, starting the search at the specified index. If the character is |
| not found, then this method returns -1. |
| |
| <p>There is no restriction on the value of <code>fromIndex</code>. If negative or greater |
| than <code>toIndex</code>, then the behavior of this method is as if the search started |
| from 0 or <code>toIndex</code> respectively. This is consistent with the behavior documented |
| in <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#indexOf(int,int)" title="class or interface in java.lang" class="external-link"><code>String.indexOf(int, int)</code></a>.</p></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the character sequence in which to perform the search, or <code>null</code>.</dd> |
| <dd><code>toSearch</code> - the Unicode code point of the character to search.</dd> |
| <dd><code>fromIndex</code> - the index to start the search from.</dd> |
| <dd><code>toIndex</code> - the index after the last character where to perform the search.</dd> |
| <dt>Returns:</dt> |
| <dd>the index of the first occurrence of the given character in the specified sub-sequence, |
| or -1 if no occurrence has been found or if the <code>text</code> argument is null.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#indexOf(int,int)" title="class or interface in java.lang" class="external-link"><code>String.indexOf(int, int)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="lastIndexOf(java.lang.CharSequence,int,int,int)"> |
| <h3>lastIndexOf</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">int</span> <span class="element-name">lastIndexOf</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| int toSearch, |
| int fromIndex, |
| int toIndex)</span></div> |
| <div class="block">Returns the index within the given character sequence of the last occurrence of the |
| specified character, searching backward in the given index range. |
| If the character is not found, then this method returns -1. |
| |
| <p>There is no restriction on the value of <code>toIndex</code>. If greater than the text length |
| or less than <code>fromIndex</code>, then the behavior of this method is as if the search started |
| from <code>length</code> or <code>fromIndex</code> respectively. This is consistent with the behavior |
| documented in <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#lastIndexOf(int,int)" title="class or interface in java.lang" class="external-link"><code>String.lastIndexOf(int, int)</code></a>.</p></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the character sequence in which to perform the search, or <code>null</code>.</dd> |
| <dd><code>toSearch</code> - the Unicode code point of the character to search.</dd> |
| <dd><code>fromIndex</code> - the index of the first character in the range where to perform the search.</dd> |
| <dd><code>toIndex</code> - the index after the last character in the range where to perform the search.</dd> |
| <dt>Returns:</dt> |
| <dd>the index of the last occurrence of the given character in the specified sub-sequence, |
| or -1 if no occurrence has been found or if the <code>text</code> argument is null.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#lastIndexOf(int,int)" title="class or interface in java.lang" class="external-link"><code>String.lastIndexOf(int, int)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="indexOfLineStart(java.lang.CharSequence,int,int)"> |
| <h3>indexOfLineStart</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">int</span> <span class="element-name">indexOfLineStart</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| int numLines, |
| int fromIndex)</span></div> |
| <div class="block">Returns the index of the first character after the given number of lines. |
| This method counts the number of occurrence of <code>'\n'</code>, <code>'\r'</code> |
| or <code>"\r\n"</code> starting from the given position. When <code>numLines</code> |
| occurrences have been found, the index of the first character after the last |
| occurrence is returned. |
| |
| <p>If the <code>numLines</code> argument is positive, this method searches forward. |
| If negative, this method searches backward. If 0, this method returns the |
| beginning of the current line.</p> |
| |
| <p>If this method reaches the end of <code>text</code> while searching forward, then |
| <code>text.length()</code> is returned. If this method reaches the beginning of |
| <code>text</code> while searching backward, then 0 is returned.</p></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the string in which to skip a determined amount of lines.</dd> |
| <dd><code>numLines</code> - the number of lines to skip. Can be positive, zero or negative.</dd> |
| <dd><code>fromIndex</code> - index at which to start the search, from 0 to <code>text.length()</code> inclusive.</dd> |
| <dt>Returns:</dt> |
| <dd>index of the first character after the last skipped line.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if the <code>text</code> argument is null.</dd> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IndexOutOfBoundsException.html" title="class or interface in java.lang" class="external-link">IndexOutOfBoundsException</a></code> - if <code>fromIndex</code> is out of bounds.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="skipLeadingWhitespaces(java.lang.CharSequence,int,int)"> |
| <h3>skipLeadingWhitespaces</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">int</span> <span class="element-name">skipLeadingWhitespaces</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| int fromIndex, |
| int toIndex)</span></div> |
| <div class="block">Returns the index of the first non-white character in the given range. |
| If the given range contains only space characters, then this method returns the index of the |
| first character after the given range, which is always equals or greater than <code>toIndex</code>. |
| Note that this character may not exist if <code>toIndex</code> is equal to the text length. |
| |
| <p>Special cases:</p> |
| <ul> |
| <li>If <code>fromIndex</code> is greater than <code>toIndex</code>, |
| then this method unconditionally returns <code>fromIndex</code>.</li> |
| <li>If the given range contains only space characters and the character at <code>toIndex-1</code> |
| is the high surrogate of a valid supplementary code point, then this method returns |
| <code>toIndex+1</code>, which is the index of the next code point.</li> |
| <li>If <code>fromIndex</code> is negative or <code>toIndex</code> is greater than the text length, |
| then the behavior of this method is undefined.</li> |
| </ul> |
| |
| Space characters are identified by the <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#isWhitespace(int)" title="class or interface in java.lang" class="external-link"><code>Character.isWhitespace(int)</code></a> method.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the string in which to perform the search (cannot be null).</dd> |
| <dd><code>fromIndex</code> - the index from which to start the search (cannot be negative).</dd> |
| <dd><code>toIndex</code> - the index after the last character where to perform the search.</dd> |
| <dt>Returns:</dt> |
| <dd>the index within the text of the first occurrence of a non-space character, starting |
| at the specified index, or a value equals or greater than <code>toIndex</code> if none.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if the <code>text</code> argument is null.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="#skipTrailingWhitespaces(java.lang.CharSequence,int,int)"><code>skipTrailingWhitespaces(CharSequence, int, int)</code></a></li> |
| <li><a href="#trimWhitespaces(java.lang.CharSequence)"><code>trimWhitespaces(CharSequence)</code></a></li> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#stripLeading()" title="class or interface in java.lang" class="external-link"><code>String.stripLeading()</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="skipTrailingWhitespaces(java.lang.CharSequence,int,int)"> |
| <h3>skipTrailingWhitespaces</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">int</span> <span class="element-name">skipTrailingWhitespaces</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| int fromIndex, |
| int toIndex)</span></div> |
| <div class="block">Returns the index <em>after</em> the last non-white character in the given range. |
| If the given range contains only space characters, then this method returns the index of the |
| first character in the given range, which is always equals or lower than <code>fromIndex</code>. |
| |
| <p>Special cases:</p> |
| <ul> |
| <li>If <code>fromIndex</code> is lower than <code>toIndex</code>, |
| then this method unconditionally returns <code>toIndex</code>.</li> |
| <li>If the given range contains only space characters and the character at <code>fromIndex</code> |
| is the low surrogate of a valid supplementary code point, then this method returns |
| <code>fromIndex-1</code>, which is the index of the code point.</li> |
| <li>If <code>fromIndex</code> is negative or <code>toIndex</code> is greater than the text length, |
| then the behavior of this method is undefined.</li> |
| </ul> |
| |
| Space characters are identified by the <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#isWhitespace(int)" title="class or interface in java.lang" class="external-link"><code>Character.isWhitespace(int)</code></a> method.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the string in which to perform the search (cannot be null).</dd> |
| <dd><code>fromIndex</code> - the index from which to start the search (cannot be negative).</dd> |
| <dd><code>toIndex</code> - the index after the last character where to perform the search.</dd> |
| <dt>Returns:</dt> |
| <dd>the index within the text of the last occurrence of a non-space character, starting |
| at the specified index, or a value equals or lower than <code>fromIndex</code> if none.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if the <code>text</code> argument is null.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="#skipLeadingWhitespaces(java.lang.CharSequence,int,int)"><code>skipLeadingWhitespaces(CharSequence, int, int)</code></a></li> |
| <li><a href="#trimWhitespaces(java.lang.CharSequence)"><code>trimWhitespaces(CharSequence)</code></a></li> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#stripTrailing()" title="class or interface in java.lang" class="external-link"><code>String.stripTrailing()</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="split(java.lang.CharSequence,char)"> |
| <h3>split</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a>[]</span> <span class="element-name">split</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| char separator)</span></div> |
| <div class="block">Splits a text around the given character. The array returned by this method contains all |
| subsequences of the given text that is terminated by the given character or is terminated |
| by the end of the text. The subsequences in the array are in the order in which they occur |
| in the given text. If the character is not found in the input, then the resulting array has |
| just one element, which is the whole given text. |
| |
| <p>This method is similar to the standard <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#split(java.lang.String)" title="class or interface in java.lang" class="external-link"><code>String.split(String)</code></a> method except for the |
| following:</p> |
| |
| <ul> |
| <li>It accepts generic character sequences.</li> |
| <li>It accepts <code>null</code> argument, in which case an empty array is returned.</li> |
| <li>The separator is a simple character instead of a regular expression.</li> |
| <li>If the <code>separator</code> argument is <code>'\n'</code> or <code>'\r'</code>, then this method |
| splits around any of <code>"\r"</code>, <code>"\n"</code> or <code>"\r\n"</code> characters sequences. |
| <li>The leading and trailing spaces of each subsequences are trimmed.</li> |
| </ul></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the text to split, or <code>null</code>.</dd> |
| <dd><code>separator</code> - the delimiting character (typically the coma).</dd> |
| <dt>Returns:</dt> |
| <dd>the array of subsequences computed by splitting the given text around the given |
| character, or an empty array if <code>text</code> was null.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list"> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#split(java.lang.String)" title="class or interface in java.lang" class="external-link"><code>String.split(String)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="splitOnEOL(java.lang.CharSequence)"> |
| <h3>splitOnEOL</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a>[]</span> <span class="element-name">splitOnEOL</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text)</span></div> |
| <div class="block">Splits a text around the <cite>End Of Line</cite> (EOL) characters. |
| EOL characters can be any of <code>"\r"</code>, <code>"\n"</code> or <code>"\r\n"</code> sequences. |
| Each element in the returned array will be a single line. If the given text is already |
| a single line, then this method returns a singleton containing only the given text. |
| |
| <p>Notes:</p> |
| <ul> |
| <li>At the difference of <code><a href="#split(java.lang.CharSequence,char)">split</a>(toSplit, '\n’)</code>, |
| this method does not remove whitespaces.</li> |
| <li>This method does not check for Unicode |
| <a href="Characters.html#LINE_SEPARATOR">line separator</a> and |
| <a href="Characters.html#PARAGRAPH_SEPARATOR">paragraph separator</a>.</li> |
| </ul> |
| |
| <h4 id="performance-note-heading">Performance note</h4> |
| Prior Java 8 this method was usually cheap because all string instances created by |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#substring(int,int)" title="class or interface in java.lang" class="external-link"><code>String.substring(int,int)</code></a> shared the same <code>char[]</code> internal array. |
| However, since Java 8, the new <code>String</code> implementation copies the data in new arrays. |
| Consequently, it is better to use index rather than this method for splitting large <code>String</code>s. |
| However, this method still useful for other <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link"><code>CharSequence</code></a> implementations providing an efficient |
| <code>subSequence(int,int)</code> method.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the multi-line text from which to get the individual lines, or <code>null</code>.</dd> |
| <dt>Returns:</dt> |
| <dd>the lines in the text, or an empty array if the given text was null.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="#indexOfLineStart(java.lang.CharSequence,int,int)"><code>indexOfLineStart(CharSequence, int, int)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="parseDoubles(java.lang.CharSequence,char)"> |
| <h3>parseDoubles</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">double[]</span> <span class="element-name">parseDoubles</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> values, |
| char separator)</span> |
| throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NumberFormatException.html" title="class or interface in java.lang" class="external-link">NumberFormatException</a></span></div> |
| <div class="block"><a href="#split(java.lang.CharSequence,char)">Splits</a> the given text around the given character, |
| then <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#parseDouble(java.lang.String)" title="class or interface in java.lang" class="external-link">parses</a> each item as a <code>double</code>. |
| Empty sub-sequences are parsed as <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>Double.NaN</code></a>.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>values</code> - the text containing the values to parse, or <code>null</code>.</dd> |
| <dd><code>separator</code> - the delimiting character (typically the coma).</dd> |
| <dt>Returns:</dt> |
| <dd>the array of numbers parsed from the given text, |
| or an empty array if <code>values</code> was null.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NumberFormatException.html" title="class or interface in java.lang" class="external-link">NumberFormatException</a></code> - if at least one number cannot be parsed.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="parseFloats(java.lang.CharSequence,char)"> |
| <h3>parseFloats</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">float[]</span> <span class="element-name">parseFloats</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> values, |
| char separator)</span> |
| throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NumberFormatException.html" title="class or interface in java.lang" class="external-link">NumberFormatException</a></span></div> |
| <div class="block"><a href="#split(java.lang.CharSequence,char)">Splits</a> the given text around the given character, |
| then <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Float.html#parseFloat(java.lang.String)" title="class or interface in java.lang" class="external-link">parses</a> each item as a <code>float</code>. |
| Empty sub-sequences are parsed as <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Float.html#NaN" title="class or interface in java.lang" class="external-link"><code>Float.NaN</code></a>.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>values</code> - the text containing the values to parse, or <code>null</code>.</dd> |
| <dd><code>separator</code> - the delimiting character (typically the coma).</dd> |
| <dt>Returns:</dt> |
| <dd>the array of numbers parsed from the given text, |
| or an empty array if <code>values</code> was null.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NumberFormatException.html" title="class or interface in java.lang" class="external-link">NumberFormatException</a></code> - if at least one number cannot be parsed.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="parseLongs(java.lang.CharSequence,char,int)"> |
| <h3>parseLongs</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">long[]</span> <span class="element-name">parseLongs</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> values, |
| char separator, |
| int radix)</span> |
| throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NumberFormatException.html" title="class or interface in java.lang" class="external-link">NumberFormatException</a></span></div> |
| <div class="block"><a href="#split(java.lang.CharSequence,char)">Splits</a> the given text around the given character, |
| then <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Long.html#parseLong(java.lang.String)" title="class or interface in java.lang" class="external-link">parses</a> each item as a <code>long</code>.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>values</code> - the text containing the values to parse, or <code>null</code>.</dd> |
| <dd><code>separator</code> - the delimiting character (typically the coma).</dd> |
| <dd><code>radix</code> - the radix to be used for parsing. This is usually 10.</dd> |
| <dt>Returns:</dt> |
| <dd>the array of numbers parsed from the given text, |
| or an empty array if <code>values</code> was null.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NumberFormatException.html" title="class or interface in java.lang" class="external-link">NumberFormatException</a></code> - if at least one number cannot be parsed.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="parseInts(java.lang.CharSequence,char,int)"> |
| <h3>parseInts</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">int[]</span> <span class="element-name">parseInts</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> values, |
| char separator, |
| int radix)</span> |
| throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NumberFormatException.html" title="class or interface in java.lang" class="external-link">NumberFormatException</a></span></div> |
| <div class="block"><a href="#split(java.lang.CharSequence,char)">Splits</a> the given text around the given character, |
| then <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Integer.html#parseInt(java.lang.String)" title="class or interface in java.lang" class="external-link">parses</a> each item as an <code>int</code>.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>values</code> - the text containing the values to parse, or <code>null</code>.</dd> |
| <dd><code>separator</code> - the delimiting character (typically the coma).</dd> |
| <dd><code>radix</code> - the radix to be used for parsing. This is usually 10.</dd> |
| <dt>Returns:</dt> |
| <dd>the array of numbers parsed from the given text, |
| or an empty array if <code>values</code> was null.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NumberFormatException.html" title="class or interface in java.lang" class="external-link">NumberFormatException</a></code> - if at least one number cannot be parsed.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="parseShorts(java.lang.CharSequence,char,int)"> |
| <h3>parseShorts</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">short[]</span> <span class="element-name">parseShorts</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> values, |
| char separator, |
| int radix)</span> |
| throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NumberFormatException.html" title="class or interface in java.lang" class="external-link">NumberFormatException</a></span></div> |
| <div class="block"><a href="#split(java.lang.CharSequence,char)">Splits</a> the given text around the given character, |
| then <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Short.html#parseShort(java.lang.String)" title="class or interface in java.lang" class="external-link">parses</a> each item as a <code>short</code>.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>values</code> - the text containing the values to parse, or <code>null</code>.</dd> |
| <dd><code>separator</code> - the delimiting character (typically the coma).</dd> |
| <dd><code>radix</code> - the radix to be used for parsing. This is usually 10.</dd> |
| <dt>Returns:</dt> |
| <dd>the array of numbers parsed from the given text, |
| or an empty array if <code>values</code> was null.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NumberFormatException.html" title="class or interface in java.lang" class="external-link">NumberFormatException</a></code> - if at least one number cannot be parsed.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="parseBytes(java.lang.CharSequence,char,int)"> |
| <h3>parseBytes</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">byte[]</span> <span class="element-name">parseBytes</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> values, |
| char separator, |
| int radix)</span> |
| throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NumberFormatException.html" title="class or interface in java.lang" class="external-link">NumberFormatException</a></span></div> |
| <div class="block"><a href="#split(java.lang.CharSequence,char)">Splits</a> the given text around the given character, |
| then <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Byte.html#parseByte(java.lang.String)" title="class or interface in java.lang" class="external-link">parses</a> each item as a <code>byte</code>.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>values</code> - the text containing the values to parse, or <code>null</code>.</dd> |
| <dd><code>separator</code> - the delimiting character (typically the coma).</dd> |
| <dd><code>radix</code> - the radix to be used for parsing. This is usually 10.</dd> |
| <dt>Returns:</dt> |
| <dd>the array of numbers parsed from the given text, |
| or an empty array if <code>values</code> was null.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NumberFormatException.html" title="class or interface in java.lang" class="external-link">NumberFormatException</a></code> - if at least one number cannot be parsed.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="toASCII(java.lang.CharSequence)"> |
| <h3>toASCII</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></span> <span class="element-name">toASCII</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text)</span></div> |
| <div class="block">Replaces some Unicode characters by ASCII characters on a "best effort basis". |
| For example, the “ é ” character is replaced by “ e ” (without accent), |
| the “ ″ ” symbol for minutes of angle is replaced by straight double quotes “ " ”, |
| and combined characters like ㎏, ㎎, ㎝, ㎞, ㎢, ㎦, ㎖, ㎧, ㎩, ㎐, <i>etc.</i> are replaced |
| by the corresponding sequences of characters. |
| |
| <div class="note"><b>Note:</b> |
| the replacement of Greek letters is a more complex task than what this method can do, |
| since it depends on the context. For example if the Greek letters are abbreviations |
| for coordinate system axes like φ and λ, then the replacements depend on the enclosing |
| coordinate system. See <a href="../../../../../org.apache.sis.referencing/org/apache/sis/io/wkt/Transliterator.html" title="class in org.apache.sis.io.wkt"><code>Transliterator</code></a> for more information.</div></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the text to scan for Unicode characters to replace by ASCII characters, or <code>null</code>.</dd> |
| <dt>Returns:</dt> |
| <dd>the given text with substitutions applied, or <code>text</code> if no replacement |
| has been applied, or <code>null</code> if the given text was null.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="StringBuilders.html#toASCII(java.lang.StringBuilder)"><code>StringBuilders.toASCII(StringBuilder)</code></a></li> |
| <li><a href="../../../../../org.apache.sis.referencing/org/apache/sis/io/wkt/Transliterator.html#filter(java.lang.String)"><code>Transliterator.filter(String)</code></a></li> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/text/Normalizer.html" title="class or interface in java.text" class="external-link"><code>Normalizer</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="trimWhitespaces(java.lang.String)"> |
| <h3>trimWhitespaces</h3> |
| <div class="member-signature"><span class="annotations"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Deprecated.html" title="class or interface in java.lang" class="external-link">@Deprecated</a>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Deprecated.html#since()" title="class or interface in java.lang" class="external-link">since</a>="1.4", |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Deprecated.html#forRemoval()" title="class or interface in java.lang" class="external-link">forRemoval</a>=true) |
| </span><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span> <span class="element-name">trimWhitespaces</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> text)</span></div> |
| <div class="deprecation-block"><span class="deprecated-label">Deprecated, for removal: This API element is subject to removal in a future version.</span> |
| <div class="deprecation-comment">Replaced by <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#strip()" title="class or interface in java.lang" class="external-link"><code>String.strip()</code></a> in JDK 11.</div> |
| </div> |
| <div class="block">Returns a string with leading and trailing whitespace characters omitted. |
| This method is similar in purpose to <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#trim()" title="class or interface in java.lang" class="external-link"><code>String.trim()</code></a>, except that the latter considers |
| every <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#isISOControl(int)" title="class or interface in java.lang" class="external-link">ISO control codes</a> below 32 to be a whitespace. |
| That <code>String.trim()</code> behavior has the side effect of removing the heading of ANSI escape |
| sequences (a.k.a. X3.64), and to ignore Unicode spaces. This <code>trimWhitespaces(…)</code> method |
| is built on the more accurate <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#isWhitespace(int)" title="class or interface in java.lang" class="external-link"><code>Character.isWhitespace(int)</code></a> method instead. |
| |
| <p>This method performs the same work than <a href="#trimWhitespaces(java.lang.CharSequence)"><code>trimWhitespaces(CharSequence)</code></a>, |
| but is overloaded for the <code>String</code> type because of its frequent use.</p></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the text from which to remove leading and trailing whitespaces, or <code>null</code>.</dd> |
| <dt>Returns:</dt> |
| <dd>a string with leading and trailing whitespaces removed, or <code>null</code> is the given |
| text was null.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="trimWhitespaces(java.lang.CharSequence)"> |
| <h3>trimWhitespaces</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></span> <span class="element-name">trimWhitespaces</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text)</span></div> |
| <div class="block">Returns a text with leading and trailing whitespace characters omitted. |
| Space characters are identified by the <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#isWhitespace(int)" title="class or interface in java.lang" class="external-link"><code>Character.isWhitespace(int)</code></a> method. |
| |
| <p>This method is the generic version of <a href="#trimWhitespaces(java.lang.String)"><code>trimWhitespaces(String)</code></a>.</p></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the text from which to remove leading and trailing whitespaces, or <code>null</code>.</dd> |
| <dt>Returns:</dt> |
| <dd>a characters sequence with leading and trailing whitespaces removed, |
| or <code>null</code> is the given text was null.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="#skipLeadingWhitespaces(java.lang.CharSequence,int,int)"><code>skipLeadingWhitespaces(CharSequence, int, int)</code></a></li> |
| <li><a href="#skipTrailingWhitespaces(java.lang.CharSequence,int,int)"><code>skipTrailingWhitespaces(CharSequence, int, int)</code></a></li> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#strip()" title="class or interface in java.lang" class="external-link"><code>String.strip()</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="trimWhitespaces(java.lang.CharSequence,int,int)"> |
| <h3>trimWhitespaces</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></span> <span class="element-name">trimWhitespaces</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| int lower, |
| int upper)</span></div> |
| <div class="block">Returns a sub-sequence with leading and trailing whitespace characters omitted. |
| Space characters are identified by the <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#isWhitespace(int)" title="class or interface in java.lang" class="external-link"><code>Character.isWhitespace(int)</code></a> method. |
| |
| <p>Invoking this method is functionally equivalent to the following code snippet, |
| except that the <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html#subSequence(int,int)" title="class or interface in java.lang" class="external-link"><code>subSequence</code></a> method is |
| invoked only once instead of two times:</p> |
| |
| |
| <div class="snippet-container"><button class="copy snippet-copy" aria-label="Copy snippet" onclick="copySnippet(this)"><span data-copied="Copied!">Copy</span><img src="../../../../../copy.svg" alt="Copy snippet"></button> |
| <pre class="snippet"><code class="language-java">text = trimWhitespaces(text.subSequence(lower, upper)); |
| </code></pre> |
| </div> |
| </div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the text from which to remove leading and trailing white spaces.</dd> |
| <dd><code>lower</code> - index of the first character to consider for inclusion in the sub-sequence.</dd> |
| <dd><code>upper</code> - index after the last character to consider for inclusion in the sub-sequence.</dd> |
| <dt>Returns:</dt> |
| <dd>a characters sequence with leading and trailing white spaces removed, or <code>null</code> |
| if the <code>text</code> argument is null.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IndexOutOfBoundsException.html" title="class or interface in java.lang" class="external-link">IndexOutOfBoundsException</a></code> - if <code>lower</code> or <code>upper</code> is out of bounds.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="trimFractionalPart(java.lang.CharSequence)"> |
| <h3>trimFractionalPart</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></span> <span class="element-name">trimFractionalPart</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> value)</span></div> |
| <div class="block">Trims the fractional part of the given formatted number, provided that it doesn't change |
| the value. This method assumes that the number is formatted in the US locale, typically |
| by the <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#toString(double)" title="class or interface in java.lang" class="external-link"><code>Double.toString(double)</code></a> method. |
| |
| <p>More specifically if the given value ends with a <code>'.'</code> character followed by a |
| sequence of <code>'0'</code> characters, then those characters are omitted. Otherwise this |
| method returns the text unchanged. This is a <cite>"all or nothing"</cite> method: |
| either the fractional part is completely removed, or either it is left unchanged.</p> |
| |
| <h4 id="examples-heading">Examples</h4> |
| This method returns <code>"4"</code> if the given value is <code>"4."</code>, <code>"4.0"</code> or |
| <code>"4.00"</code>, but returns <code>"4.10"</code> unchanged (including the trailing <code>'0'</code> |
| character) if the input is <code>"4.10"</code>. |
| |
| <h4 id="use-case-heading1">Use case</h4> |
| This method is useful before to <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Integer.html#parseInt(java.lang.String)" title="class or interface in java.lang" class="external-link">parse a number</a> |
| if that number should preferably be parsed as an integer before attempting to parse |
| it as a floating point number.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>value</code> - the value to trim if possible, or <code>null</code>.</dd> |
| <dt>Returns:</dt> |
| <dd>the value without the trailing <code>".0"</code> part (if any), |
| or <code>null</code> if the given text was null.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="StringBuilders.html#trimFractionalPart(java.lang.StringBuilder)"><code>StringBuilders.trimFractionalPart(StringBuilder)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="shortSentence(java.lang.CharSequence,int)"> |
| <h3>shortSentence</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></span> <span class="element-name">shortSentence</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| int maxLength)</span></div> |
| <div class="block">Makes sure that the <code>text</code> string is not longer than <code>maxLength</code> characters. |
| If <code>text</code> is not longer, then it is returned unchanged. Otherwise this method returns |
| a copy of <code>text</code> with some characters substituted by the <code>"(…)"</code> string. |
| |
| <p>If the text needs to be shortened, then this method tries to apply the above-cited |
| substitution between two words. For example, the following text:</p> |
| |
| <blockquote> |
| "This sentence given as an example is way too long to be included in a short name." |
| </blockquote> |
| |
| May be shortened to something like this: |
| |
| <blockquote> |
| "This sentence given (…) in a short name." |
| </blockquote></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the sentence to reduce if it is too long, or <code>null</code>.</dd> |
| <dd><code>maxLength</code> - the maximum length allowed for <code>text</code>.</dd> |
| <dt>Returns:</dt> |
| <dd>a sentence not longer than <code>maxLength</code>, or <code>null</code> if the given text was null.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="upperCaseToSentence(java.lang.CharSequence)"> |
| <h3>upperCaseToSentence</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></span> <span class="element-name">upperCaseToSentence</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> identifier)</span></div> |
| <div class="block">Given a string in upper cases (typically a Java constant), returns a string formatted |
| like an English sentence. This heuristic method performs the following steps: |
| |
| <ol> |
| <li>Replace all occurrences of <code>'_'</code> by spaces.</li> |
| <li>Converts all letters except the first one to lower case letters using |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#toLowerCase(int)" title="class or interface in java.lang" class="external-link"><code>Character.toLowerCase(int)</code></a>. Note that this method does not use |
| the <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#toLowerCase()" title="class or interface in java.lang" class="external-link"><code>String.toLowerCase()</code></a> method. Consequently, the system locale |
| is ignored. This method behaves as if the conversion were done in the |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Locale.html#ROOT" title="class or interface in java.util" class="external-link">root</a> locale.</li> |
| </ol> |
| |
| <p>Note that those heuristic rules may be modified in future SIS versions, |
| depending on the practical experience gained.</p></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>identifier</code> - the name of a Java constant, or <code>null</code>.</dd> |
| <dt>Returns:</dt> |
| <dd>the identifier like an English sentence, or <code>null</code> |
| if the given <code>identifier</code> argument was null.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="camelCaseToSentence(java.lang.CharSequence)"> |
| <h3>camelCaseToSentence</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></span> <span class="element-name">camelCaseToSentence</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> identifier)</span></div> |
| <div class="block">Given a string in camel cases (typically an identifier), returns a string formatted |
| like an English sentence. This heuristic method performs the following steps: |
| |
| <ol> |
| <li>Invoke <a href="#camelCaseToWords(java.lang.CharSequence,boolean)"><code>camelCaseToWords(CharSequence, boolean)</code></a>, which separate the words |
| on the basis of character case. For example, <code>"transferFunctionType"</code> become |
| <cite>"transfer function type"</cite>. This works fine for ISO 19115 identifiers.</li> |
| |
| <li>Next replace all occurrence of <code>'_'</code> by spaces in order to take in account |
| another common naming convention, which uses <code>'_'</code> as a word separator. This |
| convention is used by netCDF attributes like <code>"project_name"</code>.</li> |
| |
| <li>Finally ensure that the first character is upper-case.</li> |
| </ol> |
| |
| <h4 id="exception-to-the-above-rules-heading">Exception to the above rules</h4> |
| If the given identifier contains only upper-case letters, digits and the <code>'_'</code> character, |
| then the identifier is returned "as is" except for the <code>'_'</code> characters which are replaced by <code>'-'</code>. |
| This work well for identifiers like <code>"UTF-8"</code> or <code>"ISO-LATIN-1"</code> for instance. |
| |
| <p>Note that those heuristic rules may be modified in future SIS versions, |
| depending on the practical experience gained.</p></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>identifier</code> - an identifier with no space, words begin with an upper-case character, or <code>null</code>.</dd> |
| <dt>Returns:</dt> |
| <dd>the identifier with spaces inserted after what looks like words, or <code>null</code> |
| if the given <code>identifier</code> argument was null.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="camelCaseToWords(java.lang.CharSequence,boolean)"> |
| <h3>camelCaseToWords</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></span> <span class="element-name">camelCaseToWords</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> identifier, |
| boolean toLowerCase)</span></div> |
| <div class="block">Given a string in camel cases, returns a string with the same words separated by spaces. |
| A word begins with a upper-case character following a lower-case character. For example |
| if the given string is <code>"PixelInterleavedSampleModel"</code>, then this method returns |
| <cite>"Pixel Interleaved Sample Model"</cite> or <cite>"Pixel interleaved sample model"</cite> |
| depending on the value of the <code>toLowerCase</code> argument. |
| |
| <p>If <code>toLowerCase</code> is <code>false</code>, then this method inserts spaces but does not change |
| the case of characters. If <code>toLowerCase</code> is <code>true</code>, then this method changes |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#toLowerCase(int)" title="class or interface in java.lang" class="external-link">to lower case</a> the first character after each spaces |
| inserted by this method (note that this intentionally exclude the very first character in |
| the given string), except if the second character <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#isUpperCase(int)" title="class or interface in java.lang" class="external-link">is upper case</a>, in which case the word is assumed an acronym.</p> |
| |
| <p>The given string is usually a programmatic identifier like a class name or a method name.</p></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>identifier</code> - an identifier with no space, words begin with an upper-case character.</dd> |
| <dd><code>toLowerCase</code> - <code>true</code> for changing the first character of words to lower case, |
| except for the first word and acronyms.</dd> |
| <dt>Returns:</dt> |
| <dd>the identifier with spaces inserted after what looks like words, or <code>null</code> |
| if the given <code>identifier</code> argument was null.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="camelCaseToAcronym(java.lang.CharSequence)"> |
| <h3>camelCaseToAcronym</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></span> <span class="element-name">camelCaseToAcronym</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text)</span></div> |
| <div class="block">Creates an acronym from the given text. This method returns a string containing the first character of each word, |
| where the words are separated by the camel case convention, the <code>'_'</code> character, or any character which is |
| not a <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#isUnicodeIdentifierPart(int)" title="class or interface in java.lang" class="external-link">Unicode identifier part</a> (including spaces). |
| |
| <p>An exception to the above rule happens if the given text is a Unicode identifier without the <code>'_'</code> |
| character, and every characters are upper case. In such case the text is returned unchanged on the assumption |
| that it is already an acronym.</p> |
| |
| <p><b>Examples:</b> given <code>"northEast"</code>, this method returns <code>"NE"</code>. |
| Given <code>"Open Geospatial Consortium"</code>, this method returns <code>"OGC"</code>.</p></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the text for which to create an acronym, or <code>null</code>.</dd> |
| <dt>Returns:</dt> |
| <dd>the acronym, or <code>null</code> if the given text was null.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="isAcronymForWords(java.lang.CharSequence,java.lang.CharSequence)"> |
| <h3>isAcronymForWords</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">boolean</span> <span class="element-name">isAcronymForWords</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> acronym, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> words)</span></div> |
| <div class="block">Returns <code>true</code> if the first string is likely to be an acronym of the second string. |
| An acronym is a sequence of <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#isLetterOrDigit(int)" title="class or interface in java.lang" class="external-link">letters or digits</a> |
| built from at least one character of each word in the <code>words</code> string. More than |
| one character from the same word may appear in the acronym, but they must always |
| be the first consecutive characters. The comparison is case-insensitive. |
| If any of the given arguments is <code>null</code>, this method returns <code>false</code>. |
| |
| <h4 id="example-heading">Example</h4> |
| Given the <code>"Open Geospatial Consortium"</code> words, the following strings are recognized as acronyms: |
| <code>"OGC"</code>, <code>"ogc"</code>, <code>"O.G.C."</code>, <code>"OpGeoCon"</code>.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>acronym</code> - a possible acronym of the sequence of words, or <code>null</code>.</dd> |
| <dd><code>words</code> - the sequence of words, or <code>null</code>.</dd> |
| <dt>Returns:</dt> |
| <dd><code>true</code> if the first string is an acronym of the second one.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="isUnicodeIdentifier(java.lang.CharSequence)"> |
| <h3>isUnicodeIdentifier</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">boolean</span> <span class="element-name">isUnicodeIdentifier</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> identifier)</span></div> |
| <div class="block">Returns <code>true</code> if the given identifier is a legal Unicode identifier. |
| This method returns <code>true</code> if the identifier length is greater than zero, |
| the first character is a <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#isUnicodeIdentifierStart(int)" title="class or interface in java.lang" class="external-link">Unicode identifier start</a> and all remaining characters (if any) are |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#isUnicodeIdentifierPart(int)" title="class or interface in java.lang" class="external-link">Unicode identifier parts</a>. |
| |
| <h4 id="relationship-with-legal-xml-identifiers-heading">Relationship with legal XML identifiers</h4> |
| Most legal Unicode identifiers are also legal XML identifiers, but the converse is not true. |
| The most noticeable differences are the ‘<code>:</code>’, ‘<code>-</code>’ and ‘<code>.</code>’ characters, |
| which are legal in XML identifiers but not in Unicode. |
| |
| <table class="sis"> |
| <caption>Characters legal in one set but not in the other</caption> |
| <tr><th colspan="2">Not legal in Unicode</th> <th class="sep" colspan="2">Not legal in XML</th></tr> |
| <tr><td><code>:</code></td><td>(colon)</td> <td class="sep"><code>µ</code></td><td>(micro sign)</td></tr> |
| <tr><td><code>-</code></td><td>(hyphen or minus)</td> <td class="sep"><code>ª</code></td><td>(feminine ordinal indicator)</td></tr> |
| <tr><td><code>.</code></td><td>(dot)</td> <td class="sep"><code>º</code></td><td>(masculine ordinal indicator)</td></tr> |
| <tr><td><code>·</code></td><td>(middle dot)</td> <td class="sep"><code>⁔</code></td><td>(inverted undertie)</td></tr> |
| <tr> |
| <td colspan="2">Many punctuation, symbols, <i>etc</i>.</td> |
| <td colspan="2" class="sep"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#isIdentifierIgnorable(int)" title="class or interface in java.lang" class="external-link">Identifier ignorable</a> characters.</td> |
| </tr> |
| </table> |
| |
| Note that the ‘<code>_</code>’ (underscore) character is legal according both Unicode and XML, while spaces, |
| ‘<code>!</code>’, ‘<code>#</code>’, ‘<code>*</code>’, ‘<code>/</code>’, ‘<code>?</code>’ and most other punctuation characters are not. |
| |
| <h4 id="usage-in-apache-sis-heading">Usage in Apache SIS</h4> |
| In its handling of <a href="../../../../../org.apache.sis.referencing/org/apache/sis/referencing/ImmutableIdentifier.html" title="class in org.apache.sis.referencing">identifiers</a>, Apache SIS favors |
| Unicode identifiers without <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#isIdentifierIgnorable(int)" title="class or interface in java.lang" class="external-link">ignorable</a> characters since those |
| identifiers are legal XML identifiers except for the above-cited rarely used characters. As a side effect, |
| this policy excludes ‘<code>:</code>’, ‘<code>-</code>’ and ‘<code>.</code>’ which would normally be legal XML identifiers. |
| But since those characters could easily be confused with |
| <a href="../../../../../org.apache.sis.metadata/org/apache/sis/util/iso/DefaultNameSpace.html#DEFAULT_SEPARATOR">namespace separators</a>, |
| this exclusion is considered desirable.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>identifier</code> - the character sequence to test, or <code>null</code>.</dd> |
| <dt>Returns:</dt> |
| <dd><code>true</code> if the given character sequence is a legal Unicode identifier.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="../../../../../org.apache.sis.referencing/org/apache/sis/referencing/ImmutableIdentifier.html" title="class in org.apache.sis.referencing"><code>ImmutableIdentifier</code></a></li> |
| <li><a href="../../../../../org.apache.sis.metadata/org/apache/sis/metadata/iso/citation/Citations.html#toCodeSpace(org.opengis.metadata.citation.Citation)"><code>Citations.toCodeSpace(Citation)</code></a></li> |
| <li><a href="../../../../../org.apache.sis.referencing/org/apache/sis/referencing/IdentifiedObjects.html#getSimpleNameOrIdentifier(org.opengis.referencing.IdentifiedObject)"><code>IdentifiedObjects.getSimpleNameOrIdentifier(IdentifiedObject)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="isUpperCase(java.lang.CharSequence)"> |
| <h3>isUpperCase</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">boolean</span> <span class="element-name">isUpperCase</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text)</span></div> |
| <div class="block">Returns <code>true</code> if the given text is non-null, contains at least one upper-case character and |
| no lower-case character. Space and punctuation are ignored.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the character sequence to test (may be <code>null</code>).</dd> |
| <dt>Returns:</dt> |
| <dd><code>true</code> if non-null, contains at least one upper-case character and no lower-case character.</dd> |
| <dt>Since:</dt> |
| <dd>0.7</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list"> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#toUpperCase()" title="class or interface in java.lang" class="external-link"><code>String.toUpperCase()</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="equalsFiltered(java.lang.CharSequence,java.lang.CharSequence,org.apache.sis.util.Characters.Filter,boolean)"> |
| <h3>equalsFiltered</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">boolean</span> <span class="element-name">equalsFiltered</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> s1, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> s2, |
| <a href="Characters.Filter.html" title="class in org.apache.sis.util">Characters.Filter</a> filter, |
| boolean ignoreCase)</span></div> |
| <div class="block">Returns <code>true</code> if the given texts are equal, optionally ignoring case and filtered-out characters. |
| This method is sometimes used for comparing identifiers in a lenient way. |
| |
| <p><b>Example:</b> the following call compares the two strings ignoring case and any |
| characters which are not <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#isLetterOrDigit(int)" title="class or interface in java.lang" class="external-link">letter or digit</a>. |
| In particular, spaces and punctuation characters like <code>'_'</code> and <code>'-'</code> are |
| ignored:</p> |
| |
| |
| <div class="snippet-container"><button class="copy snippet-copy" aria-label="Copy snippet" onclick="copySnippet(this)"><span data-copied="Copied!">Copy</span><img src="../../../../../copy.svg" alt="Copy snippet"></button> |
| <pre class="snippet"><code class="language-java">assert equalsFiltered("WGS84", "WGS_84", Characters.Filter.LETTERS_AND_DIGITS, true) == true; |
| </code></pre> |
| </div> |
| </div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>s1</code> - the first characters sequence to compare, or <code>null</code>.</dd> |
| <dd><code>s2</code> - the second characters sequence to compare, or <code>null</code>.</dd> |
| <dd><code>filter</code> - the subset of characters to compare, or <code>null</code> for comparing all characters.</dd> |
| <dd><code>ignoreCase</code> - <code>true</code> for ignoring cases, or <code>false</code> for requiring exact match.</dd> |
| <dt>Returns:</dt> |
| <dd><code>true</code> if both arguments are <code>null</code> or if the two given texts are equal, |
| optionally ignoring case and filtered-out characters.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="equalsIgnoreCase(java.lang.CharSequence,java.lang.CharSequence)"> |
| <h3>equalsIgnoreCase</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">boolean</span> <span class="element-name">equalsIgnoreCase</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> s1, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> s2)</span></div> |
| <div class="block">Returns <code>true</code> if the two given texts are equal, ignoring case. |
| This method is similar to <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#equalsIgnoreCase(java.lang.String)" title="class or interface in java.lang" class="external-link"><code>String.equalsIgnoreCase(String)</code></a>, except |
| it works on arbitrary character sequences and compares <cite>code points</cite> |
| instead of characters.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>s1</code> - the first string to compare, or <code>null</code>.</dd> |
| <dd><code>s2</code> - the second string to compare, or <code>null</code>.</dd> |
| <dt>Returns:</dt> |
| <dd><code>true</code> if the two given texts are equal, ignoring case, |
| or if both arguments are <code>null</code>.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#equalsIgnoreCase(java.lang.String)" title="class or interface in java.lang" class="external-link"><code>String.equalsIgnoreCase(String)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="equals(java.lang.CharSequence,java.lang.CharSequence)"> |
| <h3>equals</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">boolean</span> <span class="element-name">equals</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> s1, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> s2)</span></div> |
| <div class="block">Returns <code>true</code> if the two given texts are equal. This method delegates to |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#contentEquals(java.lang.CharSequence)" title="class or interface in java.lang" class="external-link"><code>String.contentEquals(CharSequence)</code></a> if possible. This method never invoke |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html#toString()" title="class or interface in java.lang" class="external-link"><code>CharSequence.toString()</code></a> in order to avoid a potentially large copy of data.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>s1</code> - the first string to compare, or <code>null</code>.</dd> |
| <dd><code>s2</code> - the second string to compare, or <code>null</code>.</dd> |
| <dt>Returns:</dt> |
| <dd><code>true</code> if the two given texts are equal, or if both arguments are <code>null</code>.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#contentEquals(java.lang.CharSequence)" title="class or interface in java.lang" class="external-link"><code>String.contentEquals(CharSequence)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="regionMatches(java.lang.CharSequence,int,java.lang.CharSequence)"> |
| <h3>regionMatches</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">boolean</span> <span class="element-name">regionMatches</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| int fromIndex, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> part)</span></div> |
| <div class="block">Returns <code>true</code> if the given text at the given offset contains the given part, |
| in a case-sensitive comparison. This method is equivalent to the following code, |
| except that this method works on arbitrary <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link"><code>CharSequence</code></a> objects instead of |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link"><code>String</code></a>s only: |
| |
| |
| <div class="snippet-container"><button class="copy snippet-copy" aria-label="Copy snippet" onclick="copySnippet(this)"><span data-copied="Copied!">Copy</span><img src="../../../../../copy.svg" alt="Copy snippet"></button> |
| <pre class="snippet"><code class="language-java">return text.regionMatches(offset, part, 0, part.length()); |
| </code></pre> |
| </div> |
| |
| |
| This method does not thrown <code>IndexOutOfBoundsException</code>. Instead, if |
| <code>fromIndex < 0</code> or <code>fromIndex + part.length() > text.length()</code>, |
| then this method returns <code>false</code>.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the character sequence for which to tests for the presence of <code>part</code>.</dd> |
| <dd><code>fromIndex</code> - the offset in <code>text</code> where to test for the presence of <code>part</code>.</dd> |
| <dd><code>part</code> - the part which may be present in <code>text</code>.</dd> |
| <dt>Returns:</dt> |
| <dd><code>true</code> if <code>text</code> contains <code>part</code> at the given <code>offset</code>.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if any of the arguments is null.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#regionMatches(int,java.lang.String,int,int)" title="class or interface in java.lang" class="external-link"><code>String.regionMatches(int, String, int, int)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="regionMatches(java.lang.CharSequence,int,java.lang.CharSequence,boolean)"> |
| <h3>regionMatches</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">boolean</span> <span class="element-name">regionMatches</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| int fromIndex, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> part, |
| boolean ignoreCase)</span></div> |
| <div class="block">Returns <code>true</code> if the given text at the given offset contains the given part, |
| optionally in a case-insensitive way. This method is equivalent to the following code, |
| except that this method works on arbitrary <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link"><code>CharSequence</code></a> objects instead of |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link"><code>String</code></a>s only: |
| |
| |
| <div class="snippet-container"><button class="copy snippet-copy" aria-label="Copy snippet" onclick="copySnippet(this)"><span data-copied="Copied!">Copy</span><img src="../../../../../copy.svg" alt="Copy snippet"></button> |
| <pre class="snippet"><code class="language-java">return text.regionMatches(ignoreCase, offset, part, 0, part.length()); |
| </code></pre> |
| </div> |
| |
| |
| This method does not thrown <code>IndexOutOfBoundsException</code>. Instead, if |
| <code>fromIndex < 0</code> or <code>fromIndex + part.length() > text.length()</code>, |
| then this method returns <code>false</code>.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the character sequence for which to tests for the presence of <code>part</code>.</dd> |
| <dd><code>fromIndex</code> - the offset in <code>text</code> where to test for the presence of <code>part</code>.</dd> |
| <dd><code>part</code> - the part which may be present in <code>text</code>.</dd> |
| <dd><code>ignoreCase</code> - <code>true</code> if the case should be ignored.</dd> |
| <dt>Returns:</dt> |
| <dd><code>true</code> if <code>text</code> contains <code>part</code> at the given <code>offset</code>.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if any of the arguments is null.</dd> |
| <dt>Since:</dt> |
| <dd>0.4</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#regionMatches(boolean,int,java.lang.String,int,int)" title="class or interface in java.lang" class="external-link"><code>String.regionMatches(boolean, int, String, int, int)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="startsWith(java.lang.CharSequence,java.lang.CharSequence,boolean)"> |
| <h3>startsWith</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">boolean</span> <span class="element-name">startsWith</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> prefix, |
| boolean ignoreCase)</span></div> |
| <div class="block">Returns <code>true</code> if the given character sequence starts with the given prefix.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the characters sequence to test.</dd> |
| <dd><code>prefix</code> - the expected prefix.</dd> |
| <dd><code>ignoreCase</code> - <code>true</code> if the case should be ignored.</dd> |
| <dt>Returns:</dt> |
| <dd><code>true</code> if the given sequence starts with the given prefix.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if any of the arguments is null.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="endsWith(java.lang.CharSequence,java.lang.CharSequence,boolean)"> |
| <h3>endsWith</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">boolean</span> <span class="element-name">endsWith</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> suffix, |
| boolean ignoreCase)</span></div> |
| <div class="block">Returns <code>true</code> if the given character sequence ends with the given suffix.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the characters sequence to test.</dd> |
| <dd><code>suffix</code> - the expected suffix.</dd> |
| <dd><code>ignoreCase</code> - <code>true</code> if the case should be ignored.</dd> |
| <dt>Returns:</dt> |
| <dd><code>true</code> if the given sequence ends with the given suffix.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if any of the arguments is null.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="commonPrefix(java.lang.CharSequence,java.lang.CharSequence)"> |
| <h3>commonPrefix</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></span> <span class="element-name">commonPrefix</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> s1, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> s2)</span></div> |
| <div class="block">Returns the longest sequence of characters which is found at the beginning of the two given texts. |
| If one of those texts is <code>null</code>, then the other text is returned. |
| If there is no common prefix, then this method returns an empty string.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>s1</code> - the first text, or <code>null</code>.</dd> |
| <dd><code>s2</code> - the second text, or <code>null</code>.</dd> |
| <dt>Returns:</dt> |
| <dd>the common prefix of both texts (may be empty), or <code>null</code> if both texts are null.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="commonSuffix(java.lang.CharSequence,java.lang.CharSequence)"> |
| <h3>commonSuffix</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></span> <span class="element-name">commonSuffix</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> s1, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> s2)</span></div> |
| <div class="block">Returns the longest sequence of characters which is found at the end of the two given texts. |
| If one of those texts is <code>null</code>, then the other text is returned. |
| If there is no common suffix, then this method returns an empty string.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>s1</code> - the first text, or <code>null</code>.</dd> |
| <dd><code>s2</code> - the second text, or <code>null</code>.</dd> |
| <dt>Returns:</dt> |
| <dd>the common suffix of both texts (may be empty), or <code>null</code> if both texts are null.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="commonWords(java.lang.CharSequence,java.lang.CharSequence)"> |
| <h3>commonWords</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></span> <span class="element-name">commonWords</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> s1, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> s2)</span></div> |
| <div class="block">Returns the words found at the beginning and end of both texts. |
| The returned string is the concatenation of the <a href="#commonPrefix(java.lang.CharSequence,java.lang.CharSequence)">common prefix</a> |
| with the <a href="#commonSuffix(java.lang.CharSequence,java.lang.CharSequence)">common suffix</a>, with prefix and suffix eventually made |
| shorter for avoiding to cut in the middle of a word. |
| |
| <p>The purpose of this method is to create a global identifier from a list of component identifiers. |
| The latter are often eastward and northward components of a vector, in which case this method provides |
| an identifier for the vector as a whole.</p> |
| |
| <p>If one of the given texts is <code>null</code>, then the other text is returned. |
| If there are no common words, then this method returns an empty string.</p> |
| |
| <h4 id="example-heading1">Example</h4> |
| Given the following inputs: |
| <ul> |
| <li><code>"baroclinic_eastward_velocity"</code></li> |
| <li><code>"baroclinic_northward_velocity"</code></li> |
| </ul> |
| This method returns <code>"baroclinic_velocity"</code>. Note that the <code>"ward"</code> characters |
| are a common suffix of both texts but nevertheless omitted because they cut a word. |
| |
| <h4 id="possible-future-evolution-heading">Possible future evolution</h4> |
| Current implementation searches only for a common prefix and a common suffix, ignoring any common words |
| that may appear in the middle of the strings. A character is considered the beginning of a word if it is |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#isLetterOrDigit(int)" title="class or interface in java.lang" class="external-link">a letter or digit</a> which is not preceded by another letter or |
| digit (as leading "s" and "c" in "snake_case"), or if it is an <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#isUpperCase(int)" title="class or interface in java.lang" class="external-link">upper case</a> letter preceded by a <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#isLowerCase(int)" title="class or interface in java.lang" class="external-link">lower case</a> letter or no letter |
| (as both "C" in "CamelCase").</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>s1</code> - the first text, or <code>null</code>.</dd> |
| <dd><code>s2</code> - the second text, or <code>null</code>.</dd> |
| <dt>Returns:</dt> |
| <dd>the common suffix of both texts (may be empty), or <code>null</code> if both texts are null.</dd> |
| <dt>Since:</dt> |
| <dd>1.1</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="token(java.lang.CharSequence,int)"> |
| <h3>token</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></span> <span class="element-name">token</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| int fromIndex)</span></div> |
| <div class="block">Returns the token starting at the given offset in the given text. For the purpose of this |
| method, a "token" is any sequence of consecutive characters of the same type, as defined |
| below. |
| |
| <p>Let define <var>c</var> as the first non-blank character located at an index equals or |
| greater than the given offset. Then the characters that are considered of the same type |
| are:</p> |
| |
| <ul> |
| <li>If <var>c</var> is a |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#isUnicodeIdentifierStart(int)" title="class or interface in java.lang" class="external-link">Unicode identifier start</a>, |
| then any following characters that are |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#isUnicodeIdentifierPart(int)" title="class or interface in java.lang" class="external-link">Unicode identifier part</a>.</li> |
| <li>Otherwise any character for which <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Character.html#getType(int)" title="class or interface in java.lang" class="external-link"><code>Character.getType(int)</code></a> returns |
| the same value than for <var>c</var>.</li> |
| </ul></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the text for which to get the token.</dd> |
| <dd><code>fromIndex</code> - index of the first character to consider in the given text.</dd> |
| <dt>Returns:</dt> |
| <dd>a sub-sequence of <code>text</code> starting at the given offset, or an empty string |
| if there are no non-blank character at or after the given offset.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if the <code>text</code> argument is null.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="replace(java.lang.CharSequence,java.lang.CharSequence,java.lang.CharSequence)"> |
| <h3>replace</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a></span> <span class="element-name">replace</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> text, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> toSearch, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> replaceBy)</span></div> |
| <div class="block">Replaces all occurrences of a given string in the given character sequence. If no occurrence of |
| <code>toSearch</code> is found in the given text or if <code>toSearch</code> is equal to <code>replaceBy</code>, |
| then this method returns the <code>text</code> unchanged. |
| Otherwise this method returns a new character sequence with all occurrences replaced by <code>replaceBy</code>. |
| |
| <p>This method is similar to <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#replace(java.lang.CharSequence,java.lang.CharSequence)" title="class or interface in java.lang" class="external-link"><code>String.replace(CharSequence, CharSequence)</code></a> except that is accepts |
| arbitrary <code>CharSequence</code> objects. As of Java 10, another difference is that this method does not |
| create a new <code>String</code> if <code>toSearch</code> is equal to <code>replaceBy</code>.</p></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>text</code> - the character sequence in which to perform the replacements, or <code>null</code>.</dd> |
| <dd><code>toSearch</code> - the string to replace.</dd> |
| <dd><code>replaceBy</code> - the replacement for the searched string.</dd> |
| <dt>Returns:</dt> |
| <dd>the given text with replacements applied, or <code>text</code> if no replacement has been applied, |
| or <code>null</code> if the given text was null</dd> |
| <dt>Since:</dt> |
| <dd>0.4</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#replace(char,char)" title="class or interface in java.lang" class="external-link"><code>String.replace(char, char)</code></a></li> |
| <li><a href="StringBuilders.html#replace(java.lang.StringBuilder,java.lang.String,java.lang.String)"><code>StringBuilders.replace(StringBuilder, String, String)</code></a></li> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#replace(java.lang.CharSequence,java.lang.CharSequence)" title="class or interface in java.lang" class="external-link"><code>String.replace(CharSequence, CharSequence)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="copyChars(java.lang.CharSequence,int,char[],int,int)"> |
| <h3>copyChars</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">void</span> <span class="element-name">copyChars</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> src, |
| int srcOffset, |
| char[] dst, |
| int dstOffset, |
| int length)</span></div> |
| <div class="block">Copies a sequence of characters in the given <code>char[]</code> array.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>src</code> - the characters sequence from which to copy characters.</dd> |
| <dd><code>srcOffset</code> - index of the first character from <code>src</code> to copy.</dd> |
| <dd><code>dst</code> - the array where to copy the characters.</dd> |
| <dd><code>dstOffset</code> - index where to write the first character in <code>dst</code>.</dd> |
| <dd><code>length</code> - number of characters to copy.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#getChars(int,int,char%5B%5D,int)" title="class or interface in java.lang" class="external-link"><code>String.getChars(int, int, char[], int)</code></a></li> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/StringBuilder.html#getChars(int,int,char%5B%5D,int)" title="class or interface in java.lang" class="external-link"><code>StringBuilder.getChars(int, int, char[], int)</code></a></li> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/StringBuffer.html#getChars(int,int,char%5B%5D,int)" title="class or interface in java.lang" class="external-link"><code>StringBuffer.getChars(int, int, char[], int)</code></a></li> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/CharBuffer.html#get(char%5B%5D,int,int)" title="class or interface in java.nio" class="external-link"><code>CharBuffer.get(char[], int, int)</code></a></li> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/javax/swing/text/Segment.html#array" title="class or interface in javax.swing.text" class="external-link"><code>Segment.array</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </section> |
| <!-- ========= END OF CLASS DATA ========= --> |
| </main> |
| </div> |
| </div> |
| </body> |
| </html> |