./src/share/classes/java/lang/String.java

Print this page
rev 5707 : [mq]: StringRepeat


2345      *
2346      * @param  regex
2347      *         the delimiting regular expression
2348      *
2349      * @return  the array of strings computed by splitting this string
2350      *          around matches of the given regular expression
2351      *
2352      * @throws  PatternSyntaxException
2353      *          if the regular expression's syntax is invalid
2354      *
2355      * @see java.util.regex.Pattern
2356      *
2357      * @since 1.4
2358      * @spec JSR-51
2359      */
2360     public String[] split(String regex) {
2361         return split(regex, 0);
2362     }
2363 
2364     /**
















2365      * Converts all of the characters in this {@code String} to lower
2366      * case using the rules of the given {@code Locale}.  Case mapping is based
2367      * on the Unicode Standard version specified by the {@link java.lang.Character Character}
2368      * class. Since case mappings are not always 1:1 char mappings, the resulting
2369      * {@code String} may be a different length than the original {@code String}.
2370      * <p>
2371      * Examples of lowercase  mappings are in the following table:
2372      * <table border="1" summary="Lowercase mapping examples showing language code of locale, upper case, lower case, and description">
2373      * <tr>
2374      *   <th>Language Code of Locale</th>
2375      *   <th>Upper Case</th>
2376      *   <th>Lower Case</th>
2377      *   <th>Description</th>
2378      * </tr>
2379      * <tr>
2380      *   <td>tr (Turkish)</td>
2381      *   <td>&#92;u0130</td>
2382      *   <td>&#92;u0069</td>
2383      *   <td>capital letter I with dot above -&gt; small letter i</td>
2384      * </tr>




2345      *
2346      * @param  regex
2347      *         the delimiting regular expression
2348      *
2349      * @return  the array of strings computed by splitting this string
2350      *          around matches of the given regular expression
2351      *
2352      * @throws  PatternSyntaxException
2353      *          if the regular expression's syntax is invalid
2354      *
2355      * @see java.util.regex.Pattern
2356      *
2357      * @since 1.4
2358      * @spec JSR-51
2359      */
2360     public String[] split(String regex) {
2361         return split(regex, 0);
2362     }
2363 
2364     /**
2365      * Set the value of this {@code String} to {@code n} concatenated copies of the
2366      * current value.  If {@code n == 0}, then set the value to the empty string.
2367      * 
2368      * @param n the number of times to add the current value
2369      * @return a reference to this String
2370      * @throws IllegalArgumentException if n < 0
2371      * @since 1.8
2372      */
2373     public String repeat( int n ) {
2374         if (n < 0) {
2375             throw new IllegalArgumentException( "n < 0");
2376         }
2377         return new StringBuilder().append(n, this).toString();
2378     }
2379 
2380     /**
2381      * Converts all of the characters in this {@code String} to lower
2382      * case using the rules of the given {@code Locale}.  Case mapping is based
2383      * on the Unicode Standard version specified by the {@link java.lang.Character Character}
2384      * class. Since case mappings are not always 1:1 char mappings, the resulting
2385      * {@code String} may be a different length than the original {@code String}.
2386      * <p>
2387      * Examples of lowercase  mappings are in the following table:
2388      * <table border="1" summary="Lowercase mapping examples showing language code of locale, upper case, lower case, and description">
2389      * <tr>
2390      *   <th>Language Code of Locale</th>
2391      *   <th>Upper Case</th>
2392      *   <th>Lower Case</th>
2393      *   <th>Description</th>
2394      * </tr>
2395      * <tr>
2396      *   <td>tr (Turkish)</td>
2397      *   <td>&#92;u0130</td>
2398      *   <td>&#92;u0069</td>
2399      *   <td>capital letter I with dot above -&gt; small letter i</td>
2400      * </tr>