0001 
0002 /*
0003  *  JScripter Standard 1.0 - To Script In Java
0004  *  Copyright (C) 2008-2011  J.J.Liu<jianjunliu@126.com> <http://www.jscripter.org>
0005  *  
0006  *  This program is free software: you can redistribute it and/or modify
0007  *  it under the terms of the GNU Affero General Public License as published by
0008  *  the Free Software Foundation, either version 3 of the License, or
0009  *  (at your option) any later version.
0010  *  
0011  *  This program is distributed in the hope that it will be useful,
0012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014  *  GNU Affero General Public License for more details.
0015  *  
0016  *  You should have received a copy of the GNU Affero General Public License
0017  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
0018  */
0019 
0020 package jsx.core;
0021 
0022 import js.*;
0023 import js.core.*;
0024 
0025 /**
0026  * <p>A utility class providing basic string operations with its static methods.</p>
0027  * <p>Users are encouraged to use the utilities provided by this class instead of the 
0028  * <b>opaque</b> methods of {@link js.StringLike}, {@link js.core.JsString} or 
0029  * {@link js.Value.String} in consideration of the reuse benefit for re-compilation 
0030  * results.</p>
0031  * 
0032  * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.jscripter.org" target="_blank">http://www.jscripter.org</a>
0033  */
0034 public final class StringLikes extends Disposable
0035 {
0036     private StringLikes() {}
0037 
0038     /**
0039      * <p>Gets the length of the current string, an integer that indicates the number of 
0040      * characters in the current string. For any string <tt>s</tt>, the index of the 
0041      * last character is <tt>s.length() - 1</tt>. The length property of a string may 
0042      * not be deleted.</p>
0043      * @param s The current string.
0044      * @return The length of the current string.
0045      * @see js.StringLike#length()
0046      * @since 1.0
0047      */
0048     public static final int length(StringLike s) {
0049         return s.length();
0050     }
0051     public static final String fromCharCode(Object ch) {
0052         return JsGlobal.String.with().fromCharCode(ch);
0053     }
0054     /**
0055      * <p>Returns the character string of length 1 at the specified <tt>index</tt> within 
0056      * the current string. An index ranges from 0 to <tt>length() - 1</tt>. The first 
0057      * character of the sequence is at index 0, the next at index 1, and so on, as for 
0058      * array indexing. If <tt>index</tt> is not between 0 and <tt>length() - 1</tt>, 
0059      * this invocation returns an empty string.</p>
0060      * @param s The current string.
0061      * @param index The index of the character
0062      * @return The character string of length 1 at the specified index of the current string
0063      * @see #charCodeAt(js.StringLike, Object)
0064      * @see #indexOf(js.StringLike, Object)
0065      * @see #indexOf(js.StringLike, Object, Object)
0066      * @see #lastIndexOf(js.StringLike, Object)
0067      * @see #lastIndexOf(js.StringLike, Object, Object)
0068      * @see js.StringLike#charAt(Object)
0069      * @since 1.0
0070      */
0071     public static final String charAt(StringLike s, Object index) {
0072         return s.charAt(index);
0073     }
0074     /**
0075      * <p>Returns the character string of length 1 at the specified <tt>index</tt> within 
0076      * the current string. An index ranges from 0 to <tt>length() - 1</tt>. The first 
0077      * character of the sequence is at index 0, the next at index 1, and so on, as for 
0078      * array indexing. If <tt>index</tt> is not between 0 and <tt>length() - 1</tt>, 
0079      * this invocation returns an empty string.</p>
0080      * @param s The current string.
0081      * @param index The index of the character
0082      * @return The character string of length 1 at the specified index of the current string
0083      * @see #charCodeAt(String, Object)
0084      * @see #indexOf(String, Object)
0085      * @see #indexOf(String, Object, Object)
0086      * @see #lastIndexOf(String, Object)
0087      * @see #lastIndexOf(String, Object, Object)
0088      * @see js.Value.String#charAt(Object)
0089      * @since 1.0
0090      */
0091     public static final String charAt(String s, Object index) {
0092         return new Value.String(s).charAt(index);
0093     }
0094     /**
0095      * <p>Returns the character encoding at a specific <tt>index</tt> within the current 
0096      * string. An index ranges from 0 to <tt>length() - 1</tt>. The first 
0097      * character of the sequence is at index 0, the next at index 1, and so on, as for 
0098      * array indexing. If <tt>index</tt> is not between 0 and <tt>length() - 1</tt>, 
0099      * this invocation returns <tt>NaN</tt>.</p>
0100      * @param s The current string.
0101      * @param index The index of the character
0102      * @return The Unicode encoding of the character within the current string. The return 
0103      * value is a 16-bit integer between 0 and 65535.
0104      * @see #charAt(js.StringLike, Object)
0105      * @see #indexOf(js.StringLike, Object)
0106      * @see #indexOf(js.StringLike, Object, Object)
0107      * @see #lastIndexOf(js.StringLike, Object)
0108      * @see #lastIndexOf(js.StringLike, Object, Object)
0109      * @see js.StringLike#charCodeAt(Object)
0110      * @since 1.0
0111      */
0112     public static final Character charCodeAt(StringLike s, Object index) {
0113         return s.charCodeAt(index);
0114     }
0115     /**
0116      * <p>Returns the character encoding at a specific <tt>index</tt> within the current 
0117      * string. An index ranges from 0 to <tt>length() - 1</tt>. The first 
0118      * character of the sequence is at index 0, the next at index 1, and so on, as for 
0119      * array indexing. If <tt>index</tt> is not between 0 and <tt>length() - 1</tt>, 
0120      * this invocation returns <tt>NaN</tt>.</p>
0121      * @param s The current string.
0122      * @param index The index of the character
0123      * @return The Unicode encoding of the character within the current string. The return 
0124      * value is a 16-bit integer between 0 and 65535.
0125      * @see #charAt(String, Object)
0126      * @see #indexOf(String, Object)
0127      * @see #indexOf(String, Object, Object)
0128      * @see #lastIndexOf(String, Object)
0129      * @see #lastIndexOf(String, Object, Object)
0130      * @see js.Value.String#charCodeAt(Object)
0131      * @since 1.0
0132      */
0133     public static final Character charCodeAt(String s, Object index) {
0134         return new Value.String(s).charCodeAt(index);
0135     }
0136     /**
0137      * <p>Converts the argument to a string (if necessary) and appends them, in order, to 
0138      * the end of the current string and returns the resulting concatenation.</p>
0139      * <p>Note that the current string itself is not modified.</p>
0140      * <p>This method is an analog to {@link ArrayLikes#concat(js.ArrayLike, Object)}. Note that it is 
0141      * often easier to use {@link Js#add(Object, Object)} perform string concatenation.</p>
0142      * @param s The current string.
0143      * @param other A value to be concatenated to the current string
0144      * @return A new string that results from concatenating the argument to the current 
0145      * string.
0146      * @see ArrayLikes#concat(js.ArrayLike, Object)
0147      * @see js.StringLike#concat(Object)
0148      * @since 1.0
0149      */
0150     public static final String concat(StringLike s, Object other) {
0151         return s.concat(other);
0152     }
0153     /**
0154      * <p>Converts the argument to a string (if necessary) and appends them, in order, to 
0155      * the end of the current string and returns the resulting concatenation.</p>
0156      * <p>Note that the current string itself is not modified.</p>
0157      * <p>This method is an analog to {@link ArrayLikes#concat(js.ArrayLike, Object)}. Note that it is 
0158      * often easier to use {@link Js#add(Object, Object)} perform string concatenation.</p>
0159      * @param s The current string.
0160      * @param other A value to be concatenated to the current string
0161      * @return A new string that results from concatenating the argument to the current 
0162      * string.
0163      * @see ArrayLikes#concat(js.ArrayLike, Object)
0164      * @see js.Value.String#concat(Object)
0165      * @since 1.0
0166      */
0167     public static final String concat(String s, Object other) {
0168         return new Value.String(s).concat(other);
0169     }
0170     /**
0171      * <p>Searches the current string instance from beginning to end to see if it contains 
0172      * an occurrence of the substring <tt>other</tt>. The search begins at the beginning 
0173      * of the current string. If an occurrence of the substring is found, this invocation 
0174      * returns the position of the first character of the first occurrence of the substring 
0175      * within the current string. Character positions within string are numbered starting with 
0176      * zero. If no occurrence of substring is found within the current string, this invocation 
0177      * returns -1.</p>
0178      * @param s The current string.
0179      * @param other The substring that is to be searched for within the current string
0180      * @return The position of the first occurrence of <tt>other</tt> within string, if 
0181      * any, or -1 if no such occurrence is found.
0182      * @see #indexOf(js.StringLike, Object, Object)
0183      * @see #charAt(js.StringLike, Object)
0184      * @see #lastIndexOf(js.StringLike, Object)
0185      * @see #lastIndexOf(js.StringLike, Object, Object)
0186      * @see #substr(js.StringLike, Object)
0187      * @see #substr(js.StringLike, Object, Object)
0188      * @see #substring(js.StringLike, Object)
0189      * @see #substring(js.StringLike, Object, Object)
0190      * @see js.StringLike#indexOf(Object)
0191      * @since 1.0
0192      */
0193     public static final int indexOf(StringLike s, Object other) {
0194         return s.indexOf(other);
0195     }
0196     /**
0197      * <p>Searches the current string instance from beginning to end to see if it contains 
0198      * an occurrence of the substring <tt>other</tt>. The search begins at the beginning 
0199      * of the current string. If an occurrence of the substring is found, this invocation 
0200      * returns the position of the first character of the first occurrence of the substring 
0201      * within the current string. Character positions within string are numbered starting with 
0202      * zero. If no occurrence of substring is found within the current string, this invocation 
0203      * returns -1.</p>
0204      * @param s The current string.
0205      * @param other The substring that is to be searched for within the current string
0206      * @return The position of the first occurrence of <tt>other</tt> within string, if 
0207      * any, or -1 if no such occurrence is found.
0208      * @see #indexOf(String, Object, Object)
0209      * @see #charAt(String, Object)
0210      * @see #lastIndexOf(String, Object)
0211      * @see #lastIndexOf(String, Object, Object)
0212      * @see #substr(String, Object)
0213      * @see #substr(String, Object, Object)
0214      * @see #substring(String, Object)
0215      * @see #substring(String, Object, Object)
0216      * @see js.Value.String#indexOf(Object)
0217      * @since 1.0
0218      */
0219     public static final int indexOf(String s, Object other) {
0220         return new Value.String(s).indexOf(other).intValue();
0221     }
0222     /**
0223      * <p>Searches the current string instance from beginning to end to see if it contains 
0224      * an occurrence of the substring <tt>other</tt>. The search begins at position 
0225      * <tt>pos</tt> within string, or at the beginning of string if <tt>pos</tt> is  
0226      * undefined. If an occurrence of the substring is found, this invocation returns the 
0227      * position of the first character of the first occurrence of the substring within 
0228      * the current string. Character positions within string are numbered starting with 
0229      * zero. If no occurrence of substring is found within the current string, this invocation 
0230      * returns -1.</p>
0231      * @param s The current string.
0232      * @param other The substring that is to be searched for within the current string
0233      * @param pos An optional integer argument that specifies the position within the 
0234      * current string at which the search is to start. Legal values are 0 (the position of 
0235      * the first character in the string) to <tt>length() - 1</tt> (the position of 
0236      * the last character in the string). If this argument is undefined, the search begins 
0237      * at the first character of the string
0238      * @return The position of the first occurrence of <tt>other</tt> within string that 
0239      * appears after the <tt>pos</tt> position, if any, or -1 if no such occurrence 
0240      * is found.
0241      * @see #indexOf(js.StringLike, Object)
0242      * @see #charAt(js.StringLike, Object)
0243      * @see #lastIndexOf(js.StringLike, Object)
0244      * @see #lastIndexOf(js.StringLike, Object, Object)
0245      * @see #substr(js.StringLike, Object)
0246      * @see #substr(js.StringLike, Object, Object)
0247      * @see #substring(js.StringLike, Object)
0248      * @see #substring(js.StringLike, Object, Object)
0249      * @see js.StringLike#indexOf(Object, Object)
0250      * @since 1.0
0251      */
0252     public static final int indexOf(StringLike s, Object other, Object pos) {
0253         return s.indexOf(other, pos);
0254     }
0255     /**
0256      * <p>Searches the current string instance from beginning to end to see if it contains 
0257      * an occurrence of the substring <tt>other</tt>. The search begins at position 
0258      * <tt>pos</tt> within string, or at the beginning of string if <tt>pos</tt> is  
0259      * undefined. If an occurrence of the substring is found, this invocation returns the 
0260      * position of the first character of the first occurrence of the substring within 
0261      * the current string. Character positions within string are numbered starting with 
0262      * zero. If no occurrence of substring is found within the current string, this invocation 
0263      * returns -1.</p>
0264      * @param s The current string.
0265      * @param other The substring that is to be searched for within the current string
0266      * @param pos An optional integer argument that specifies the position within the 
0267      * current string at which the search is to start. Legal values are 0 (the position of 
0268      * the first character in the string) to <tt>length() - 1</tt> (the position of 
0269      * the last character in the string). If this argument is undefined, the search begins 
0270      * at the first character of the string
0271      * @return The position of the first occurrence of <tt>other</tt> within string that 
0272      * appears after the <tt>pos</tt> position, if any, or -1 if no such occurrence 
0273      * is found.
0274      * @see #indexOf(String, Object)
0275      * @see #charAt(String, Object)
0276      * @see #lastIndexOf(String, Object)
0277      * @see #lastIndexOf(String, Object, Object)
0278      * @see #substr(String, Object)
0279      * @see #substr(String, Object, Object)
0280      * @see #substring(String, Object)
0281      * @see #substring(String, Object, Object)
0282      * @see js.Value.String#indexOf(Object, Object)
0283      * @since 1.0
0284      */
0285     public static final int indexOf(String s, Object other, Object pos) {
0286         return new Value.String(s).indexOf(other, pos).intValue();
0287     }
0288     /**
0289      * <p>Searches the current string instance from end to beginning to see if it contains 
0290      * an occurrence of the substring <tt>other</tt>. The search begins at the end 
0291      * of the current string. If an occurrence of the substring is found, this invocation 
0292      * returns the position of the first character of that occurrence. If no occurrence of 
0293      * substring is found within the current string, this invocation returns -1.</p>
0294      * @param s The current string.
0295      * @param other The substring that is to be searched for within the current string
0296      * @return The position of the last occurrence of <tt>other</tt> within string, if 
0297      * any, or -1 if no such occurrence is found.
0298      * @see #lastIndexOf(js.StringLike, Object, Object)
0299      * @see #charAt(js.StringLike, Object)
0300      * @see #indexOf(js.StringLike, Object)
0301      * @see #indexOf(js.StringLike, Object, Object)
0302      * @see #substr(js.StringLike, Object)
0303      * @see #substr(js.StringLike, Object, Object)
0304      * @see #substring(js.StringLike, Object)
0305      * @see #substring(js.StringLike, Object, Object)
0306      * @see js.StringLike#lastIndexOf(Object)
0307      * @since 1.0
0308      */
0309     public static final int lastIndexOf(StringLike s, Object other) {
0310         return s.lastIndexOf(other);
0311     }
0312     /**
0313      * <p>Searches the current string instance from end to beginning to see if it contains 
0314      * an occurrence of the substring <tt>other</tt>. The search begins at the end 
0315      * of the current string. If an occurrence of the substring is found, this invocation 
0316      * returns the position of the first character of that occurrence. If no occurrence of 
0317      * substring is found within the current string, this invocation returns -1.</p>
0318      * @param s The current string.
0319      * @param other The substring that is to be searched for within the current string
0320      * @return The position of the last occurrence of <tt>other</tt> within string, if 
0321      * any, or -1 if no such occurrence is found.
0322      * @see #lastIndexOf(String, Object, Object)
0323      * @see #charAt(String, Object)
0324      * @see #indexOf(String, Object)
0325      * @see #indexOf(String, Object, Object)
0326      * @see #substr(String, Object)
0327      * @see #substr(String, Object, Object)
0328      * @see #substring(String, Object)
0329      * @see #substring(String, Object, Object)
0330      * @see js.Value.String#lastIndexOf(Object)
0331      * @since 1.0
0332      */
0333     public static final int lastIndexOf(String s, Object other) {
0334         return new Value.String(s).lastIndexOf(other).intValue();
0335     }
0336     /**
0337      * <p>Searches the current string instance from end to beginning to see if it contains 
0338      * an occurrence of the substring <tt>other</tt>. The search begins at position 
0339      * <tt>pos</tt> within string, or at the end of string if <tt>pos</tt> is  
0340      * undefined. If an occurrence of the substring is found, this invocation returns the 
0341      * position of the first character that occurrence. Since this method 
0342      * searches from end to beginning of the string, the first occurrence found is the last 
0343      * one in the string that occurs before the <tt>pos</tt> position. If no occurrence 
0344      * of substring is found within the current string, this invocation returns -1.</p>
0345      * @param s The current string.
0346      * @param other The substring that is to be searched for within the current string
0347      * @param pos An optional integer argument that specifies the position within the 
0348      * current string at which the search is to start. Legal values are 0 (the position of 
0349      * the first character in the string) to <tt>length() - 1</tt> (the position of 
0350      * the last character in the string). If this argument is undefined, the search begins 
0351      * at the last character of the string
0352      * @return The position of the last occurrence of <tt>other</tt> within string that 
0353      * appears before the <tt>pos</tt> position, if any, or -1 if no such occurrence 
0354      * is found.
0355      * @see #lastIndexOf(js.StringLike, Object)
0356      * @see #charAt(js.StringLike, Object)
0357      * @see #indexOf(js.StringLike, Object)
0358      * @see #indexOf(js.StringLike, Object, Object)
0359      * @see #substr(js.StringLike, Object)
0360      * @see #substr(js.StringLike, Object, Object)
0361      * @see #substring(js.StringLike, Object)
0362      * @see #substring(js.StringLike, Object, Object)
0363      * @see js.StringLike#lastIndexOf(Object, Object)
0364      * @since 1.0
0365      */
0366     public static final int lastIndexOf(StringLike s, Object other, Object pos) {
0367         return s.lastIndexOf(other, pos);
0368     }
0369     /**
0370      * <p>Searches the current string instance from end to beginning to see if it contains 
0371      * an occurrence of the substring <tt>other</tt>. The search begins at position 
0372      * <tt>pos</tt> within string, or at the end of string if <tt>pos</tt> is  
0373      * undefined. If an occurrence of the substring is found, this invocation returns the 
0374      * position of the first character that occurrence. Since this method 
0375      * searches from end to beginning of the string, the first occurrence found is the last 
0376      * one in the string that occurs before the <tt>pos</tt> position. If no occurrence 
0377      * of substring is found within the current string, this invocation returns -1.</p>
0378      * @param s The current string.
0379      * @param other The substring that is to be searched for within the current string
0380      * @param pos An optional integer argument that specifies the position within the 
0381      * current string at which the search is to start. Legal values are 0 (the position of 
0382      * the first character in the string) to <tt>length() - 1</tt> (the position of 
0383      * the last character in the string). If this argument is undefined, the search begins 
0384      * at the last character of the string
0385      * @return The position of the last occurrence of <tt>other</tt> within string that 
0386      * appears before the <tt>pos</tt> position, if any, or -1 if no such occurrence 
0387      * is found.
0388      * @see #lastIndexOf(String, Object)
0389      * @see #charAt(String, Object)
0390      * @see #indexOf(String, Object)
0391      * @see #indexOf(String, Object, Object)
0392      * @see #substr(String, Object)
0393      * @see #substr(String, Object, Object)
0394      * @see #substring(String, Object)
0395      * @see #substring(String, Object, Object)
0396      * @see js.Value.String#lastIndexOf(Object, Object)
0397      * @since 1.0
0398      */
0399     public static final int lastIndexOf(String s, Object other, Object pos) {
0400         return new Value.String(s).lastIndexOf(other, pos).intValue();
0401     }
0402     /**
0403      * <p>Compares strings taking the collation order of the default locale into account.</p>
0404      * <p>The ECMAScript standard does not specify how the locale-specific comparison is done; 
0405      * it merely specifies that this function utilize the collation order provided by the 
0406      * underlying operating system.</p>
0407      * @param s The current string.
0408      * @param other A string to be compared, in a locale-sensitive fashion, with the current string
0409      * @return An integer number that indicates the result of the comparison. If the current 
0410      * string is "less than" the string <tt>other</tt>, this invocation returns a 
0411      * number less than zero. If the current string is "greater than" <tt>other</tt>, 
0412      * it returns a integer number greater than zero. And if the strings are identical or 
0413      * indistinguishable according to the locale ordering conventions, the method returns 0.
0414      * @see js.StringLike#localeCompare(Object)
0415      * @since 1.0
0416      */
0417     public static final int localeCompare(StringLike s, Object other) {
0418         return s.localeCompare(other);
0419     }
0420     /**
0421      * <p>Compares strings taking the collation order of the default locale into account.</p>
0422      * <p>The ECMAScript standard does not specify how the locale-specific comparison is done; 
0423      * it merely specifies that this function utilize the collation order provided by the 
0424      * underlying operating system.</p>
0425      * @param s The current string.
0426      * @param other A string to be compared, in a locale-sensitive fashion, with the current string
0427      * @return An integer number that indicates the result of the comparison. If the current 
0428      * string is "less than" the string <tt>other</tt>, this invocation returns a 
0429      * number less than zero. If the current string is "greater than" <tt>other</tt>, 
0430      * it returns a integer number greater than zero. And if the strings are identical or 
0431      * indistinguishable according to the locale ordering conventions, the method returns 0.
0432      * @see js.StringLike#localeCompare(Object)
0433      * @since 1.0
0434      */
0435     public static final int localeCompare(String s, Object other) {
0436         return new Value.String(s).localeCompare(other).intValue();
0437     }
0438     /**
0439      * <p>Searches the current string for one or more matches of <tt>regexp</tt>. 
0440      * The behavior of this invocation depends significantly on whether <tt>regexp</tt> 
0441      * has the "g" attribute or not .</p>
0442      * <p>If <tt>regexp</tt> does not have the "g" attribute, this invocation searches 
0443      * string for a single match. If no match is found, it returns <tt>null</tt>. 
0444      * Otherwise, it returns an array containing information about the match that it found. 
0445      * Element 0 of the array contains the matched text. The remaining elements contain 
0446      * the text that matches any parenthesized subexpressions within the regular expression. 
0447      * In addition to these normal array elements, the returned array also has two object 
0448      * properties. The <tt>index</tt> property (see {@link ArrayLikes#index(js.ArrayLike)}) of the array  
0449      * specifies the character position within string of the start of the matched text. Also, 
0450      * the <tt>input</tt> property (see {@link ArrayLikes#input(js.ArrayLike)}) of the returned array 
0451      * is a reference to string itself.</p>
0452      * <p>If <tt>regexp</tt> has the "g" flag, this invocation does a global search, 
0453      * searching string for all matching substrings. It returns <tt>null</tt> if no 
0454      * match is found, and it returns an array if one or more matches are found. The 
0455      * contents of this returned array are quite different for global matches, however. In 
0456      * this case, the array elements contain each of the matched substrings within string. 
0457      * The returned array does not have <tt>index</tt> (see {@link ArrayLikes#index(js.ArrayLike)}) 
0458      * or <tt>input</tt> (see {@link ArrayLikes#input(js.ArrayLike)}) properties in this case. Note 
0459      * that for global matches, this invocation does not provide information about 
0460      * parenthesized subexpressions, nor does it specify where within string each match 
0461      * occurred. If you need to obtain this information for a global search, you can use 
0462      * {@link RegExpLikes#exec(js.RegExpLike, Object)}.</p>
0463      * @param s The current string.
0464      * @param regexp A RegExp object that specifies the pattern to be matched
0465      * @return An array containing the results of the match. The contents of the array 
0466      * depend on whether regexp has the global "g" attribute set.
0467      * @see #replace(js.StringLike, RegExpLike, String)
0468      * @see #replace(js.StringLike, RegExpLike, StringLike)
0469      * @see #replace(js.StringLike, RegExpLike, JsFunction)
0470      * @see #search(js.StringLike, RegExpLike)
0471      * @see ArrayLikes#index(js.ArrayLike)
0472      * @see ArrayLikes#input(js.ArrayLike)
0473      * @see Js#re(String)
0474      * @see Js#re(String, String)
0475      * @see RegExpLikes#exec(js.RegExpLike, Object)
0476      * @see RegExpLikes#test(js.RegExpLike, Object)
0477      * @see js.StringLike#match(js.RegExpLike)
0478      * @since 1.0
0479      */
0480     public static final ArrayLike<?> match(StringLike s, RegExpLike regexp) {
0481         return s.match(regexp);
0482     }
0483     /**
0484      * <p>Searches the current string for one or more matches of <tt>regexp</tt>. 
0485      * The behavior of this invocation depends significantly on whether <tt>regexp</tt> 
0486      * has the "g" attribute or not .</p>
0487      * <p>If <tt>regexp</tt> does not have the "g" attribute, this invocation searches 
0488      * string for a single match. If no match is found, it returns <tt>null</tt>. 
0489      * Otherwise, it returns an array containing information about the match that it found. 
0490      * Element 0 of the array contains the matched text. The remaining elements contain 
0491      * the text that matches any parenthesized subexpressions within the regular expression. 
0492      * In addition to these normal array elements, the returned array also has two object 
0493      * properties. The <tt>index</tt> property (see {@link ArrayLikes#index(js.ArrayLike)}) of the array  
0494      * specifies the character position within string of the start of the matched text. Also, 
0495      * the <tt>input</tt> property (see {@link ArrayLikes#input(js.ArrayLike)}) of the returned array 
0496      * is a reference to string itself.</p>
0497      * <p>If <tt>regexp</tt> has the "g" flag, this invocation does a global search, 
0498      * searching string for all matching substrings. It returns <tt>null</tt> if no 
0499      * match is found, and it returns an array if one or more matches are found. The 
0500      * contents of this returned array are quite different for global matches, however. In 
0501      * this case, the array elements contain each of the matched substrings within string. 
0502      * The returned array does not have <tt>index</tt> (see {@link ArrayLikes#index(js.ArrayLike)}) 
0503      * or <tt>input</tt> (see {@link ArrayLikes#input(js.ArrayLike)}) properties in this case. Note 
0504      * that for global matches, this invocation does not provide information about 
0505      * parenthesized subexpressions, nor does it specify where within string each match 
0506      * occurred. If you need to obtain this information for a global search, you can use 
0507      * {@link RegExpLikes#exec(js.RegExpLike, Object)}.</p>
0508      * @param s The current string.
0509      * @param regexp A RegExp object that specifies the pattern to be matched
0510      * @return An array containing the results of the match. The contents of the array 
0511      * depend on whether regexp has the global "g" attribute set.
0512      * @see #replace(String, RegExpLike, String)
0513      * @see #replace(String, RegExpLike, StringLike)
0514      * @see #replace(String, RegExpLike, JsFunction)
0515      * @see #search(String, RegExpLike)
0516      * @see ArrayLikes#index(js.ArrayLike)
0517      * @see ArrayLikes#input(js.ArrayLike)
0518      * @see Js#re(String)
0519      * @see Js#re(String, String)
0520      * @see RegExpLikes#exec(js.RegExpLike, Object)
0521      * @see RegExpLikes#test(js.RegExpLike, Object)
0522      * @see js.Value.String#match(js.RegExpLike)
0523      * @since 1.0
0524      */
0525     public static final ArrayLike<?> match(String s, RegExpLike regexp) {
0526         return new Value.String(s).match(regexp);
0527     }
0528     /**
0529      * <p>Performs a search-and-replace operation on the current string.</p>
0530      * <p>This invocation searches the current string for one or more substrings that 
0531      * match <tt>regexp</tt> and replaces them with the replacement string 
0532      * <tt>newSubStr</tt>.</p>
0533      * <p>If <tt>regexp</tt> has the global "g" attribute specified, this invocation 
0534      * replaces all matching substrings. Otherwise, it replaces only the first matching 
0535      * substring.</p>
0536      * <p>Note that the $ character has special meaning within the replacement string 
0537      * <tt>newSubStr</tt>. As shown in the following, it indicates that a string 
0538      * derived from the pattern match is used in the replacement.</p>
0539      * <ul>
0540      * <li>$1, $2, ..., $99 The text that matched the 1st through 99th parenthesized 
0541      * subexpression within <tt>regexp</tt></li>
0542      * <li>$& The substring that matched <tt>regexp</tt></li>
0543      * <li>$' The text to the left of the matched substring</li>
0544      * <li>$' The text to the right of the matched substring</li>
0545      * <li>$$ A literal dollar sign</li>
0546      * </ul>
0547      * @param s The current string.
0548      * @param regexp The RegExp object that specifies the pattern to be replaced
0549      * @param newSubStr A string that specifies the replacement text
0550      * @return A new string, with the first match, or all matches, of <tt>regexp</tt> 
0551      * replaced with the replacement.
0552      * @see #replace(js.StringLike, js.RegExpLike, js.StringLike)
0553      * @see #replace(js.StringLike, js.RegExpLike, js.core.JsFunction)
0554      * @see #match(js.StringLike, js.RegExpLike)
0555      * @see #search(js.StringLike, js.RegExpLike)
0556      * @see Js#re(String)
0557      * @see Js#re(String, String)
0558      * @see RegExpLikes#exec(js.RegExpLike, Object)
0559      * @see RegExpLikes#test(js.RegExpLike, Object)
0560      * @see js.StringLike#replace(js.RegExpLike, String)
0561      * @since 1.0
0562      */
0563     public static final String replace(StringLike s, RegExpLike regexp, String newSubStr) {
0564         return s.replace(regexp, newSubStr);
0565     }
0566     /**
0567      * <p>Performs a search-and-replace operation on the current string.</p>
0568      * <p>This invocation searches the current string for one or more substrings that 
0569      * match <tt>regexp</tt> and replaces them with the replacement string 
0570      * <tt>newSubStr</tt>.</p>
0571      * <p>If <tt>regexp</tt> has the global "g" attribute specified, this invocation 
0572      * replaces all matching substrings. Otherwise, it replaces only the first matching 
0573      * substring.</p>
0574      * <p>Note that the $ character has special meaning within the replacement string 
0575      * <tt>newSubStr</tt>. As shown in the following, it indicates that a string 
0576      * derived from the pattern match is used in the replacement.</p>
0577      * <ul>
0578      * <li>$1, $2, ..., $99 The text that matched the 1st through 99th parenthesized 
0579      * subexpression within <tt>regexp</tt></li>
0580      * <li>$& The substring that matched <tt>regexp</tt></li>
0581      * <li>$' The text to the left of the matched substring</li>
0582      * <li>$' The text to the right of the matched substring</li>
0583      * <li>$$ A literal dollar sign</li>
0584      * </ul>
0585      * @param s The current string.
0586      * @param regexp The RegExp object that specifies the pattern to be replaced
0587      * @param newSubStr A string that specifies the replacement text
0588      * @return A new string, with the first match, or all matches, of <tt>regexp</tt> 
0589      * replaced with the replacement.
0590      * @see #replace(js.StringLike, js.RegExpLike, String)
0591      * @see #replace(js.StringLike, js.RegExpLike, js.core.JsFunction)
0592      * @see #match(js.StringLike, js.RegExpLike)
0593      * @see #search(js.StringLike, js.RegExpLike)
0594      * @see Js#re(String)
0595      * @see Js#re(String, String)
0596      * @see RegExpLikes#exec(js.RegExpLike, Object)
0597      * @see RegExpLikes#test(js.RegExpLike, Object)
0598      * @see js.StringLike#replace(js.RegExpLike, js.StringLike)
0599      * @since 1.0
0600      */
0601     public static final String replace(StringLike s, RegExpLike regexp, StringLike newSubStr) {
0602         return replace(s, regexp, newSubStr.valueOf());
0603     }
0604     /**
0605      * <p>Performs a search-and-replace operation on the current string.</p>
0606      * <p>This invocation searches the current string for one or more substrings that 
0607      * match <tt>regexp</tt> and replaces them with the replacement string 
0608      * <tt>newSubStr</tt>.</p>
0609      * <p>If <tt>regexp</tt> has the global "g" attribute specified, this invocation 
0610      * replaces all matching substrings. Otherwise, it replaces only the first matching 
0611      * substring.</p>
0612      * <p>Note that the $ character has special meaning within the replacement string 
0613      * <tt>newSubStr</tt>. As shown in the following, it indicates that a string 
0614      * derived from the pattern match is used in the replacement.</p>
0615      * <ul>
0616      * <li>$1, $2, ..., $99 The text that matched the 1st through 99th parenthesized 
0617      * subexpression within <tt>regexp</tt></li>
0618      * <li>$& The substring that matched <tt>regexp</tt></li>
0619      * <li>$' The text to the left of the matched substring</li>
0620      * <li>$' The text to the right of the matched substring</li>
0621      * <li>$$ A literal dollar sign</li>
0622      * </ul>
0623      * @param s The current string.
0624      * @param regexp The RegExp object that specifies the pattern to be replaced
0625      * @param newSubStr A string that specifies the replacement text
0626      * @return A new string, with the first match, or all matches, of <tt>regexp</tt> 
0627      * replaced with the replacement.
0628      * @see #replace(String, js.RegExpLike, js.StringLike)
0629      * @see #replace(String, js.RegExpLike, js.core.JsFunction)
0630      * @see #match(String, js.RegExpLike)
0631      * @see #search(String, js.RegExpLike)
0632      * @see Js#re(String)
0633      * @see Js#re(String, String)
0634      * @see RegExpLikes#exec(js.RegExpLike, Object)
0635      * @see RegExpLikes#test(js.RegExpLike, Object)
0636      * @see js.Value.String#replace(js.RegExpLike, String)
0637      * @since 1.0
0638      */
0639     public static final String replace(String s, RegExpLike regexp, String newSubStr) {
0640         return new Value.String(s).replace(regexp, newSubStr);
0641     }
0642     /**
0643      * <p>Performs a search-and-replace operation on the current string.</p>
0644      * <p>This invocation searches the current string for one or more substrings that 
0645      * match <tt>regexp</tt> and replaces them with the replacement string 
0646      * <tt>newSubStr</tt>.</p>
0647      * <p>If <tt>regexp</tt> has the global "g" attribute specified, this invocation 
0648      * replaces all matching substrings. Otherwise, it replaces only the first matching 
0649      * substring.</p>
0650      * <p>Note that the $ character has special meaning within the replacement string 
0651      * <tt>newSubStr</tt>. As shown in the following, it indicates that a string 
0652      * derived from the pattern match is used in the replacement.</p>
0653      * <ul>
0654      * <li>$1, $2, ..., $99 The text that matched the 1st through 99th parenthesized 
0655      * subexpression within <tt>regexp</tt></li>
0656      * <li>$& The substring that matched <tt>regexp</tt></li>
0657      * <li>$' The text to the left of the matched substring</li>
0658      * <li>$' The text to the right of the matched substring</li>
0659      * <li>$$ A literal dollar sign</li>
0660      * </ul>
0661      * @param s The current string.
0662      * @param regexp The RegExp object that specifies the pattern to be replaced
0663      * @param newSubStr A string that specifies the replacement text
0664      * @return A new string, with the first match, or all matches, of <tt>regexp</tt> 
0665      * replaced with the replacement.
0666      * @see #replace(String, js.RegExpLike, String)
0667      * @see #replace(String, js.RegExpLike, js.core.JsFunction)
0668      * @see #match(String, js.RegExpLike)
0669      * @see #search(String, js.RegExpLike)
0670      * @see Js#re(String)
0671      * @see Js#re(String, String)
0672      * @see RegExpLikes#exec(js.RegExpLike, Object)
0673      * @see RegExpLikes#test(js.RegExpLike, Object)
0674      * @see js.Value.String#replace(js.RegExpLike, js.StringLike)
0675      * @since 1.0
0676      */
0677     public static final String replace(String s, RegExpLike regexp, StringLike newSubStr) {
0678         return replace(s, regexp, newSubStr.valueOf());
0679     }
0680     /**
0681      * <p>Performs a search-and-replace operation on the current string.</p>
0682      * <p>This invocation searches the current string for one or more substrings that 
0683      * match <tt>regexp</tt> and replaces them with the replacement string generated by 
0684      * <tt>lambda</tt>.</p>
0685      * <p>If <tt>regexp</tt> has the global "g" attribute specified, this invocation 
0686      * replaces all matching substrings. Otherwise, it replaces only the first matching 
0687      * substring.</p>
0688      * @param s The current string.
0689      * @param regexp The RegExp object that specifies the pattern to be replaced
0690      * @param lambda A function that is invoked to generate the replacement text
0691      * @return A new string, with the first match, or all matches, of <tt>regexp</tt> 
0692      * replaced with the replacement.
0693      * @see #replace(js.StringLike, js.RegExpLike, String)
0694      * @see #replace(js.StringLike, js.RegExpLike, js.StringLike)
0695      * @see #match(js.StringLike, js.RegExpLike)
0696      * @see #search(js.StringLike, js.RegExpLike)
0697      * @see Js#re(String)
0698      * @see Js#re(String, String)
0699      * @see RegExpLikes#exec(js.RegExpLike, Object)
0700      * @see RegExpLikes#test(js.RegExpLike, Object)
0701      * @see js.StringLike#replace(js.RegExpLike, JsFunction)
0702      * @since 1.0
0703      */
0704     public static final String replace(StringLike s, RegExpLike regexp, JsFunction<String> lambda) {
0705         return s.replace(regexp, lambda);
0706     }
0707     /**
0708      * <p>Performs a search-and-replace operation on the current string.</p>
0709      * <p>This invocation searches the current string for one or more substrings that 
0710      * match <tt>regexp</tt> and replaces them with the replacement string generated by 
0711      * <tt>lambda</tt>.</p>
0712      * <p>If <tt>regexp</tt> has the global "g" attribute specified, this invocation 
0713      * replaces all matching substrings. Otherwise, it replaces only the first matching 
0714      * substring.</p>
0715      * @param s The current string.
0716      * @param regexp The RegExp object that specifies the pattern to be replaced
0717      * @param lambda A function that is invoked to generate the replacement text
0718      * @return A new string, with the first match, or all matches, of <tt>regexp</tt> 
0719      * replaced with the replacement.
0720      * @see #replace(String, js.RegExpLike, String)
0721      * @see #replace(String, js.RegExpLike, js.StringLike)
0722      * @see #match(String, js.RegExpLike)
0723      * @see #search(String, js.RegExpLike)
0724      * @see Js#re(String)
0725      * @see Js#re(String, String)
0726      * @see RegExpLikes#exec(js.RegExpLike, Object)
0727      * @see RegExpLikes#test(js.RegExpLike, Object)
0728      * @see js.Value.String#replace(js.RegExpLike, JsFunction)
0729      * @since 1.0
0730      */
0731     public static final String replace(String s, RegExpLike regexp, JsFunction<String> lambda) {
0732         return new Value.String(s).replace(regexp, lambda);
0733     }
0734     /**
0735      * <p>Looks for a substring matching <tt>regexp</tt> within the current string 
0736      * and returns the position of the first character of the matching substring, 
0737      * or -1 if no match was found.</p>
0738      * <p>This invocation does not do global matches; it ignores the "g" flag of 
0739      * <tt>regexp</tt>. It also ignores the <tt>lastIndex</tt> property 
0740      * (see {@link RegExpLikes#lastIndex(js.RegExpLike)} and {@link RegExpLikes#lastIndex(js.RegExpLike, Integer)}) of 
0741      * <tt>regexp</tt> and always searches from the beginning of the string, which 
0742      * means that it always returns the position of the first match in the string.</p>
0743      * @param s The current string.
0744      * @param regexp A RegExp object that specifies the pattern to be searched for in the current string.
0745      * @return The position of the start of the first substring of the current string 
0746      * that matches <tt>regexp</tt>, or -1 if no match is found.
0747      * @see #replace(js.StringLike, RegExpLike, String)
0748      * @see #replace(js.StringLike, RegExpLike, StringLike)
0749      * @see #replace(js.StringLike, RegExpLike, JsFunction)
0750      * @see #match(js.StringLike, RegExpLike)
0751      * @see Js#re(String)
0752      * @see Js#re(String, String)
0753      * @see RegExpLikes#exec(js.RegExpLike, Object)
0754      * @see RegExpLikes#test(js.RegExpLike, Object)
0755      * @see js.StringLike#search(js.RegExpLike)
0756      * @since 1.0
0757      */
0758     public static final int search(StringLike s, RegExpLike regexp) {
0759         return s.search(regexp);
0760     }
0761     /**
0762      * <p>Looks for a substring matching <tt>regexp</tt> within the current string 
0763      * and returns the position of the first character of the matching substring, 
0764      * or -1 if no match was found.</p>
0765      * <p>This invocation does not do global matches; it ignores the "g" flag of 
0766      * <tt>regexp</tt>. It also ignores the <tt>lastIndex</tt> property 
0767      * (see {@link RegExpLikes#lastIndex(js.RegExpLike)} and {@link RegExpLikes#lastIndex(js.RegExpLike, Integer)}) of 
0768      * <tt>regexp</tt> and always searches from the beginning of the string, which 
0769      * means that it always returns the position of the first match in the string.</p>
0770      * @param s The current string.
0771      * @param regexp A RegExp object that specifies the pattern to be searched for in the current string.
0772      * @return The position of the start of the first substring of the current string 
0773      * that matches <tt>regexp</tt>, or -1 if no match is found.
0774      * @see #replace(String, RegExpLike, String)
0775      * @see #replace(String, RegExpLike, StringLike)
0776      * @see #replace(String, RegExpLike, JsFunction)
0777      * @see #match(String, RegExpLike)
0778      * @see Js#re(String)
0779      * @see Js#re(String, String)
0780      * @see RegExpLikes#exec(js.RegExpLike, Object)
0781      * @see RegExpLikes#test(js.RegExpLike, Object)
0782      * @see js.Value.String#search(js.RegExpLike)
0783      * @since 1.0
0784      */
0785     public static final int search(String s, RegExpLike regexp) {
0786         return new Value.String(s).search(regexp).intValue();
0787     }
0788     /**
0789      * <p>Returns a string containing a slice, or substring, of the current string without 
0790      * modify it.</p>
0791      * @param s The current string.
0792      * @param begin The string index where the slice is to begin. If negative, this argument 
0793      * specifies a position measured from the end of the string. That is, -1 indicates the 
0794      * last character, -2 indicates the second from last character, and so on.
0795      * @return A new string that contains all the characters of string from and including 
0796      * <tt>begin</tt>.
0797      * @see #slice(js.StringLike, Object, Object)
0798      * @see #substr(js.StringLike, Object)
0799      * @see #substr(js.StringLike, Object, Object)
0800      * @see #substring(js.StringLike, Object)
0801      * @see #substring(js.StringLike, Object, Object)
0802      * @see ArrayLikes#slice(js.ArrayLike, Object)
0803      * @see ArrayLikes#slice(js.ArrayLike, Object, Object)
0804      * @see js.StringLike#slice(Object)
0805      * @since 1.0
0806      */
0807     public static final String slice(StringLike s, Object begin) {
0808         return s.slice(begin);
0809     }
0810     /**
0811      * <p>Returns a string containing a slice, or substring, of the current string without 
0812      * modify it.</p>
0813      * @param s The current string.
0814      * @param begin The string index where the slice is to begin. If negative, this argument 
0815      * specifies a position measured from the end of the string. That is, -1 indicates the 
0816      * last character, -2 indicates the second from last character, and so on.
0817      * @return A new string that contains all the characters of string from and including 
0818      * <tt>begin</tt>.
0819      * @see #slice(String, Object, Object)
0820      * @see #substr(String, Object)
0821      * @see #substr(String, Object, Object)
0822      * @see #substring(String, Object)
0823      * @see #substring(String, Object, Object)
0824      * @see ArrayLikes#slice(js.ArrayLike, Object)
0825      * @see ArrayLikes#slice(js.ArrayLike, Object, Object)
0826      * @see js.Value.String#slice(Object)
0827      * @since 1.0
0828      */
0829     public static final String slice(String s, Object begin) {
0830         return new Value.String(s).slice(begin);
0831     }
0832     /**
0833      * <p>Returns a string containing a slice, or substring, of the current string without 
0834      * modify it.</p>
0835      * @param s The current string.
0836      * @param begin The string index where the slice is to begin. If negative, this argument 
0837      * specifies a position measured from the end of the string. That is, -1 indicates the 
0838      * last character, -2 indicates the second from last character, and so on.
0839      * @param end The string index immediately after the end of the slice. If undefined, 
0840      * the slice includes all characters from <tt>begin</tt> to the end of the string. 
0841      * If this argument is negative, it specifies a position measured from the end of the 
0842      * string.
0843      * @return A new string that contains all the characters of string from and including 
0844      * <tt>begin</tt>, and up to but not including <tt>end</tt>.
0845      * @see #slice(js.StringLike, Object, Object)
0846      * @see #substr(js.StringLike, Object)
0847      * @see #substr(js.StringLike, Object, Object)
0848      * @see #substring(js.StringLike, Object)
0849      * @see #substring(js.StringLike, Object, Object)
0850      * @see ArrayLikes#slice(js.ArrayLike, Object)
0851      * @see ArrayLikes#slice(js.ArrayLike, Object, Object)
0852      * @see js.StringLike#slice(Object, Object)
0853      * @since 1.0
0854      */
0855     public static final String slice(StringLike s, Object begin, Object end) {
0856         return s.slice(begin, end);
0857     }
0858     /**
0859      * <p>Returns a string containing a slice, or substring, of the current string without 
0860      * modify it.</p>
0861      * @param s The current string.
0862      * @param begin The string index where the slice is to begin. If negative, this argument 
0863      * specifies a position measured from the end of the string. That is, -1 indicates the 
0864      * last character, -2 indicates the second from last character, and so on.
0865      * @param end The string index immediately after the end of the slice. If undefined, 
0866      * the slice includes all characters from <tt>begin</tt> to the end of the string. 
0867      * If this argument is negative, it specifies a position measured from the end of the 
0868      * string.
0869      * @return A new string that contains all the characters of string from and including 
0870      * <tt>begin</tt>, and up to but not including <tt>end</tt>.
0871      * @see #slice(String, Object, Object)
0872      * @see #substr(String, Object)
0873      * @see #substr(String, Object, Object)
0874      * @see #substring(String, Object)
0875      * @see #substring(String, Object, Object)
0876      * @see ArrayLikes#slice(js.ArrayLike, Object)
0877      * @see ArrayLikes#slice(js.ArrayLike, Object, Object)
0878      * @see js.Value.String#slice(Object, Object)
0879      * @since 1.0
0880      */
0881     public static final String slice(String s, Object begin, Object end) {
0882         return new Value.String(s).slice(begin, end);
0883     }
0884     /**
0885      * <p>Creates and returns an array of substrings of the current string. These 
0886      * substrings are created by searching the string from start to end for text that 
0887      * matches <tt>separator</tt> and breaking the string before and after that 
0888      * matching text. The <tt>separator</tt> text is not included in any of the 
0889      * returned substrings, except as noted at the end of this section. Note that if the 
0890      * <tt>separator</tt> matches the beginning of the string, the first element of 
0891      * the returned array will be an empty string, the text that appears before the 
0892      * <tt>separator</tt>. Similarly, if the <tt>separator</tt> matches the end of 
0893      * the string, the last element of the array will be the empty string.</p>
0894      * <p>If <tt>separator</tt> is undefined, the current string is not split at all, 
0895      * and the returned array contains only a single, unbroken string element. If 
0896      * <tt>separator</tt> is the empty string or a regular expression that matches 
0897      * the empty string, the string is broken between each character, and the returned 
0898      * array has the same length as the string does. Note that this is a special case 
0899      * because the empty strings before the first character and after the last character 
0900      * are not matched.</p>
0901      * <p>As noted earlier, the substrings in the array returned by this invocation do not 
0902      * contain the delimiting text <tt>separator</tt> used to split the string. However, 
0903      * if <tt>separator</tt> is a regular expression that contains parenthesized 
0904      * subexpressions, the substrings that match those parenthesized subexpressions 
0905      * (but not the text that matches the regular expression as a whole) are included in 
0906      * the returned array.</p>
0907      * <p>Note that this method is the inverse of the {@link ArrayLikes#join(js.ArrayLike)} or 
0908      * {@link ArrayLikes#join(js.ArrayLike, Object)} method.</p>
0909      * @param s The current string.
0910      * @param separator The string or regular expression at which the current string splits.
0911      * @return An array of strings, created by splitting string into substrings at the 
0912      * boundaries specified by <tt>separator</tt>. The substrings in the returned 
0913      * array do not include <tt>separator</tt> itself, except in the case noted in the 
0914      * above description.
0915      * @see #split(js.StringLike, Object, Object)
0916      * @see ArrayLikes#join(js.ArrayLike)
0917      * @see ArrayLikes#join(js.ArrayLike, Object)
0918      * @see js.StringLike#split(Object)
0919      * @since 1.0
0920      */
0921     public static final ArrayLike<?> split(StringLike s, Object separator) {
0922         return s.split(separator);
0923     }
0924     /**
0925      * <p>Creates and returns an array of substrings of the current string. These 
0926      * substrings are created by searching the string from start to end for text that 
0927      * matches <tt>separator</tt> and breaking the string before and after that 
0928      * matching text. The <tt>separator</tt> text is not included in any of the 
0929      * returned substrings, except as noted at the end of this section. Note that if the 
0930      * <tt>separator</tt> matches the beginning of the string, the first element of 
0931      * the returned array will be an empty string, the text that appears before the 
0932      * <tt>separator</tt>. Similarly, if the <tt>separator</tt> matches the end of 
0933      * the string, the last element of the array will be the empty string.</p>
0934      * <p>If <tt>separator</tt> is undefined, the current string is not split at all, 
0935      * and the returned array contains only a single, unbroken string element. If 
0936      * <tt>separator</tt> is the empty string or a regular expression that matches 
0937      * the empty string, the string is broken between each character, and the returned 
0938      * array has the same length as the string does. Note that this is a special case 
0939      * because the empty strings before the first character and after the last character 
0940      * are not matched.</p>
0941      * <p>As noted earlier, the substrings in the array returned by this invocation do not 
0942      * contain the delimiting text <tt>separator</tt> used to split the string. However, 
0943      * if <tt>separator</tt> is a regular expression that contains parenthesized 
0944      * subexpressions, the substrings that match those parenthesized subexpressions 
0945      * (but not the text that matches the regular expression as a whole) are included in 
0946      * the returned array.</p>
0947      * <p>Note that this method is the inverse of the {@link ArrayLikes#join(js.ArrayLike)} or 
0948      * {@link ArrayLikes#join(js.ArrayLike, Object)} method.</p>
0949      * @param s The current string.
0950      * @param separator The string or regular expression at which the current string splits.
0951      * @return An array of strings, created by splitting string into substrings at the 
0952      * boundaries specified by <tt>separator</tt>. The substrings in the returned 
0953      * array do not include <tt>separator</tt> itself, except in the case noted in the 
0954      * above description.
0955      * @see #split(String, Object, Object)
0956      * @see ArrayLikes#join(js.ArrayLike)
0957      * @see ArrayLikes#join(js.ArrayLike, Object)
0958      * @see js.Value.String#split(Object)
0959      * @since 1.0
0960      */
0961     public static final ArrayLike<?> split(String s, Object separator) {
0962         return new Value.String(s).split(separator);
0963     }
0964     /**
0965      * <p>Creates and returns an array of as many as <tt>limit</tt> substrings of the 
0966      * current string. These substrings are created by searching the string from start to 
0967      * end for text that matches <tt>separator</tt> and breaking the string before and 
0968      * after that matching text. The <tt>separator</tt> text is not included in any of 
0969      * the returned substrings, except as noted at the end of this section. Note that if 
0970      * the <tt>separator</tt> matches the beginning of the string, the first element 
0971      * of the returned array will be an empty string, the text that appears before the 
0972      * <tt>separator</tt>. Similarly, if the <tt>separator</tt> matches the end of 
0973      * the string, the last element of the array (assuming no conflicting <tt>limit</tt>) 
0974      * will be the empty string.</p>
0975      * <p>If <tt>separator</tt> is undefined, the current string is not split at all, 
0976      * and the returned array contains only a single, unbroken string element. If 
0977      * <tt>separator</tt> is the empty string or a regular expression that matches 
0978      * the empty string, the string is broken between each character, and the returned 
0979      * array has the same length as the string does, assuming no smaller <tt>limit</tt> 
0980      * is specified. Note that this is a special case because the empty strings before 
0981      * the first character and after the last character are not matched.</p>
0982      * <p>As noted earlier, the substrings in the array returned by this invocation do not 
0983      * contain the delimiting text <tt>separator</tt> used to split the string. However, 
0984      * if <tt>separator</tt> is a regular expression that contains parenthesized 
0985      * subexpressions, the substrings that match those parenthesized subexpressions 
0986      * (but not the text that matches the regular expression as a whole) are included in 
0987      * the returned array.</p>
0988      * <p>Note that this method is the inverse of the {@link ArrayLike#join()} or 
0989      * {@link ArrayLike#join(Object)} method.</p>
0990      * @param s The current string.
0991      * @param separator The string or regular expression at which the current string splits.
0992      * @param limit This optional integer specifies the maximum length of the returned 
0993      * array. If defined, no more than this number of substrings will be returned. 
0994      * If undefined, the entire string will be split, regardless of its length.
0995      * @return An array of strings, created by splitting string into substrings at the 
0996      * boundaries specified by <tt>separator</tt>. The substrings in the returned 
0997      * array do not include <tt>separator</tt> itself, except in the case noted in the 
0998      * above description.
0999      * @see #split(js.StringLike, Object)
1000      * @see ArrayLikes#join(js.ArrayLike)
1001      * @see ArrayLikes#join(js.ArrayLike, Object)
1002      * @see js.StringLike#split(Object, Object)
1003      * @since 1.0
1004      */
1005     public static final ArrayLike<?> split(StringLike s, Object separator, Object limit) {
1006         return s.split(separator, limit);
1007     }
1008     /**
1009      * <p>Creates and returns an array of as many as <tt>limit</tt> substrings of the 
1010      * current string. These substrings are created by searching the string from start to 
1011      * end for text that matches <tt>separator</tt> and breaking the string before and 
1012      * after that matching text. The <tt>separator</tt> text is not included in any of 
1013      * the returned substrings, except as noted at the end of this section. Note that if 
1014      * the <tt>separator</tt> matches the beginning of the string, the first element 
1015      * of the returned array will be an empty string, the text that appears before the 
1016      * <tt>separator</tt>. Similarly, if the <tt>separator</tt> matches the end of 
1017      * the string, the last element of the array (assuming no conflicting <tt>limit</tt>) 
1018      * will be the empty string.</p>
1019      * <p>If <tt>separator</tt> is undefined, the current string is not split at all, 
1020      * and the returned array contains only a single, unbroken string element. If 
1021      * <tt>separator</tt> is the empty string or a regular expression that matches 
1022      * the empty string, the string is broken between each character, and the returned 
1023      * array has the same length as the string does, assuming no smaller <tt>limit</tt> 
1024      * is specified. Note that this is a special case because the empty strings before 
1025      * the first character and after the last character are not matched.</p>
1026      * <p>As noted earlier, the substrings in the array returned by this invocation do not 
1027      * contain the delimiting text <tt>separator</tt> used to split the string. However, 
1028      * if <tt>separator</tt> is a regular expression that contains parenthesized 
1029      * subexpressions, the substrings that match those parenthesized subexpressions 
1030      * (but not the text that matches the regular expression as a whole) are included in 
1031      * the returned array.</p>
1032      * <p>Note that this method is the inverse of the {@link ArrayLike#join()} or 
1033      * {@link ArrayLike#join(Object)} method.</p>
1034      * @param s The current string.
1035      * @param separator The string or regular expression at which the current string splits.
1036      * @param limit This optional integer specifies the maximum length of the returned 
1037      * array. If defined, no more than this number of substrings will be returned. 
1038      * If undefined, the entire string will be split, regardless of its length.
1039      * @return An array of strings, created by splitting string into substrings at the 
1040      * boundaries specified by <tt>separator</tt>. The substrings in the returned 
1041      * array do not include <tt>separator</tt> itself, except in the case noted in the 
1042      * above description.
1043      * @see #split(String, Object)
1044      * @see ArrayLikes#join(js.ArrayLike)
1045      * @see ArrayLikes#join(js.ArrayLike, Object)
1046      * @see js.Value.String#split(Object, Object)
1047      * @since 1.0
1048      */
1049     public static final ArrayLike<?> split(String s, Object separator, Object limit) {
1050         return new Value.String(s).split(separator, limit);
1051     }
1052     /**
1053      * <p>Extracts and returns a substring of the current string without modifying it.</p>
1054      * <p>Note that this method has not been standardized by ECMAScript and is therefore 
1055      * deprecated</p>
1056      * @param s The current string.
1057      * @param start The start position of the substring. If this argument is negative, it 
1058      * specifies a position measured from the end of the string: -1 specifies the last character, 
1059      * -2 specifies the second-to-last character, and so on.
1060      * @return A copy of the portion of the current string starting at and including the character 
1061      * specified by <tt>start</tt> to the end of the string.
1062      * @see #substr(js.StringLike, Object)
1063      * @see #slice(js.StringLike, Object)
1064      * @see #slice(js.StringLike, Object, Object)
1065      * @see #substring(js.StringLike, Object)
1066      * @see #substring(js.StringLike, Object, Object)
1067      * @see js.StringLike#substr(Object)
1068      * @since 1.0
1069      */
1070     public static final String substr(StringLike s, Object start) {
1071         return s.substr(start);
1072     }
1073     /**
1074      * <p>Extracts and returns a substring of the current string without modifying it.</p>
1075      * <p>Note that this method has not been standardized by ECMAScript and is therefore 
1076      * deprecated</p>
1077      * @param s The current string.
1078      * @param start The start position of the substring. If this argument is negative, it 
1079      * specifies a position measured from the end of the string: -1 specifies the last character, 
1080      * -2 specifies the second-to-last character, and so on.
1081      * @return A copy of the portion of the current string starting at and including the character 
1082      * specified by <tt>start</tt> to the end of the string.
1083      * @see #substr(String, Object)
1084      * @see #slice(String, Object)
1085      * @see #slice(String, Object, Object)
1086      * @see #substring(String, Object)
1087      * @see #substring(String, Object, Object)
1088      * @see js.Value.String#substr(Object)
1089      * @since 1.0
1090      */
1091     public static final String substr(String s, Object start) {
1092         return new Value.String(s).substr(start);
1093     }
1094     /**
1095      * <p>Extracts and returns a substring of the current string without modifying it.</p>
1096      * <p>Note this method specifies the desired substring with a character position and a 
1097      * <tt>length</tt>. This provides a useful alternative to 
1098      * {@link StringLikes#substring(js.StringLike, Object, Object)}, which specify a substring with two 
1099      * character positions. Note, however, that this method has not been standardized by 
1100      * ECMAScript and is therefore deprecated</p>
1101      * @param s The current string.
1102      * @param start The start position of the substring. If this argument is negative, it 
1103      * specifies a position measured from the end of the string: -1 specifies the last character, 
1104      * -2 specifies the second-to-last character, and so on.
1105      * @param length The number of characters in the substring. If this argument is undefined, 
1106      * the returned substring includes all characters from the starting position to the end of 
1107      * the string.
1108      * @return A copy of the portion of the current string starting at and including the character 
1109      * specified by <tt>start</tt> and continuing for <tt>length</tt> characters, 
1110      * or to the end of the string if <tt>length</tt> is undefined.
1111      * @see #substr(js.StringLike, Object)
1112      * @see #slice(js.StringLike, Object)
1113      * @see #slice(js.StringLike, Object, Object)
1114      * @see #substring(js.StringLike, Object)
1115      * @see #substring(js.StringLike, Object, Object)
1116      * @see js.StringLike#substr(Object, Object)
1117      * @since 1.0
1118      */
1119     public static final String substr(StringLike s, Object start, Object length) {
1120         return s.substr(start, length);
1121     }
1122     /**
1123      * <p>Extracts and returns a substring of the current string without modifying it.</p>
1124      * <p>Note this method specifies the desired substring with a character position and a 
1125      * <tt>length</tt>. This provides a useful alternative to 
1126      * {@link StringLikes#substring(String, Object, Object)}, which specify a substring with two 
1127      * character positions. Note, however, that this method has not been standardized by 
1128      * ECMAScript and is therefore deprecated</p>
1129      * @param s The current string.
1130      * @param start The start position of the substring. If this argument is negative, it 
1131      * specifies a position measured from the end of the string: -1 specifies the last character, 
1132      * -2 specifies the second-to-last character, and so on.
1133      * @param length The number of characters in the substring. If this argument is undefined, 
1134      * the returned substring includes all characters from the starting position to the end of 
1135      * the string.
1136      * @return A copy of the portion of the current string starting at and including the character 
1137      * specified by <tt>start</tt> and continuing for <tt>length</tt> characters, 
1138      * or to the end of the string if <tt>length</tt> is undefined.
1139      * @see #substr(String, Object)
1140      * @see #slice(String, Object)
1141      * @see #slice(String, Object, Object)
1142      * @see #substring(String, Object)
1143      * @see #substring(String, Object, Object)
1144      * @see js.Value.String#substr(Object, Object)
1145      * @since 1.0
1146      */
1147     public static final String substr(String s, Object start, Object length) {
1148         return new Value.String(s).substr(start, length);
1149     }
1150     /**
1151      * <p>Returns a substring of the current string consisting of the characters from 
1152      * position <tt>from</tt> to the end of the string. The character at position 
1153      * <tt>from</tt> is included.</p>
1154      * <p>It is important to remember that the character at position <tt>from</tt> is 
1155      * included in the substring.</p>
1156      * <p>Note that {@link StringLikes#slice(js.StringLike, Object)} and the nonstandard 
1157      * {@link StringLikes#substr(js.StringLike, Object)} can also extract substrings from a string. 
1158      * Unlike those methods, this method does not accept negative arguments.</p>
1159      * @param s The current string.
1160      * @param from A nonnegative integer that specifies the position within the current 
1161      * string of the first character of the desired substring.
1162      * @return  A substring of the current string containing characters copied from 
1163      * position <tt>from</tt> to the end of the current string.
1164      * @see #substring(js.StringLike, Object, Object)
1165      * @see #charAt(js.StringLike, Object)
1166      * @see #indexOf(js.StringLike, Object)
1167      * @see #indexOf(js.StringLike, Object, Object)
1168      * @see #lastIndexOf(js.StringLike, Object)
1169      * @see #lastIndexOf(js.StringLike, Object, Object)
1170      * @see #slice(js.StringLike, Object)
1171      * @see #slice(js.StringLike, Object, Object)
1172      * @see #substr(js.StringLike, Object)
1173      * @see #substr(js.StringLike, Object, Object)
1174      * @see js.StringLike#substring(Object)
1175      * @since 1.0
1176      */
1177     public static final String substring(StringLike s, Object from) {
1178         return s.substring(from);
1179     }
1180     /**
1181      * <p>Returns a substring of the current string consisting of the characters from 
1182      * position <tt>from</tt> to the end of the string. The character at position 
1183      * <tt>from</tt> is included.</p>
1184      * <p>It is important to remember that the character at position <tt>from</tt> is 
1185      * included in the substring.</p>
1186      * <p>Note that {@link StringLikes#slice(String, Object)} and the nonstandard 
1187      * {@link StringLikes#substr(String, Object)} can also extract substrings from a string. 
1188      * Unlike those methods, this method does not accept negative arguments.</p>
1189      * @param s The current string.
1190      * @param from A nonnegative integer that specifies the position within the current 
1191      * string of the first character of the desired substring.
1192      * @return  A substring of the current string containing characters copied from 
1193      * position <tt>from</tt> to the end of the current string.
1194      * @see #substring(String, Object, Object)
1195      * @see #charAt(String, Object)
1196      * @see #indexOf(String, Object)
1197      * @see #indexOf(String, Object, Object)
1198      * @see #lastIndexOf(String, Object)
1199      * @see #lastIndexOf(String, Object, Object)
1200      * @see #slice(String, Object)
1201      * @see #slice(String, Object, Object)
1202      * @see #substr(String, Object)
1203      * @see #substr(String, Object, Object)
1204      * @see js.Value.String#substring(Object)
1205      * @since 1.0
1206      */
1207     public static final String substring(String s, Object from) {
1208         return new Value.String(s).substring(from);
1209     }
1210     /**
1211      * <p>Returns a substring of the current string consisting of the characters between 
1212      * positions <tt>from</tt> and <tt>to</tt>. The character at position <tt>from</tt> 
1213      * is included, but the character at position <tt>to</tt> is not included.</p>
1214      * <p>If <tt>from</tt> equals <tt>to</tt>, this method returns an empty 
1215      * (length 0) string. If <tt>from</tt> is greater than <tt>to</tt>, this method 
1216      * first swaps the two arguments and then returns the substring between them.</p>
1217      * <p>It is important to remember that the character at position <tt>from</tt> is 
1218      * included in the substring but that the character at position <tt>to</tt> is 
1219      * not included in the substring. While this may seem arbitrary or counter-intuitive, 
1220      * a notable feature of this system is that the length of the returned substring is 
1221      * always equal to <tt>to - from</tt>.</p>
1222      * <p>Note that {@link StringLikes#slice(js.StringLike, Object, Object)} and the nonstandard 
1223      * {@link StringLikes#substr(js.StringLike, Object, Object)} can also extract substrings from a string. 
1224      * Unlike those methods, this method does not accept negative arguments.</p>
1225      * @param s The current string.
1226      * @param from A nonnegative integer that specifies the position within the current 
1227      * string of the first character of the desired substring.
1228      * @param to A nonnegative optional integer that is one greater than the position of 
1229      * the last character of the desired substring. If this argument is undefined, the 
1230      * returned substring runs to the end of the string.
1231      * @return A new string, of length <tt>to - from</tt>, which contains a substring 
1232      * of the current string. The new string contains characters copied from positions 
1233      * <tt>from</tt> to <tt>to</tt> - 1 of the string.
1234      * @see #substring(js.StringLike, Object)
1235      * @see #charAt(js.StringLike, Object)
1236      * @see #indexOf(js.StringLike, Object)
1237      * @see #indexOf(js.StringLike, Object, Object)
1238      * @see #lastIndexOf(js.StringLike, Object)
1239      * @see #lastIndexOf(js.StringLike, Object, Object)
1240      * @see #slice(js.StringLike, Object)
1241      * @see #slice(js.StringLike, Object, Object)
1242      * @see #substr(js.StringLike, Object)
1243      * @see #substr(js.StringLike, Object, Object)
1244      * @see js.StringLike#substring(Object, Object)
1245      * @since 1.0
1246      */
1247     public static final String substring(StringLike s, Object from, Object to) {
1248         return s.substring(from, to);
1249     }
1250     /**
1251      * <p>Returns a substring of the current string consisting of the characters between 
1252      * positions <tt>from</tt> and <tt>to</tt>. The character at position <tt>from</tt> 
1253      * is included, but the character at position <tt>to</tt> is not included.</p>
1254      * <p>If <tt>from</tt> equals <tt>to</tt>, this method returns an empty 
1255      * (length 0) string. If <tt>from</tt> is greater than <tt>to</tt>, this method 
1256      * first swaps the two arguments and then returns the substring between them.</p>
1257      * <p>It is important to remember that the character at position <tt>from</tt> is 
1258      * included in the substring but that the character at position <tt>to</tt> is 
1259      * not included in the substring. While this may seem arbitrary or counter-intuitive, 
1260      * a notable feature of this system is that the length of the returned substring is 
1261      * always equal to <tt>to - from</tt>.</p>
1262      * <p>Note that {@link StringLikes#slice(String, Object, Object)} and the nonstandard 
1263      * {@link StringLikes#substr(String, Object, Object)} can also extract substrings from a string. 
1264      * Unlike those methods, this method does not accept negative arguments.</p>
1265      * @param s The current string.
1266      * @param from A nonnegative integer that specifies the position within the current 
1267      * string of the first character of the desired substring.
1268      * @param to A nonnegative optional integer that is one greater than the position of 
1269      * the last character of the desired substring. If this argument is undefined, the 
1270      * returned substring runs to the end of the string.
1271      * @return A new string, of length <tt>to - from</tt>, which contains a substring 
1272      * of the current string. The new string contains characters copied from positions 
1273      * <tt>from</tt> to <tt>to</tt> - 1 of the string.
1274      * @see #substring(String, Object)
1275      * @see #charAt(String, Object)
1276      * @see #indexOf(String, Object)
1277      * @see #indexOf(String, Object, Object)
1278      * @see #lastIndexOf(String, Object)
1279      * @see #lastIndexOf(String, Object, Object)
1280      * @see #slice(String, Object)
1281      * @see #slice(String, Object, Object)
1282      * @see #substr(String, Object)
1283      * @see #substr(String, Object, Object)
1284      * @see js.Value.String#substring(Object, Object)
1285      * @since 1.0
1286      */
1287     public static final String substring(String s, Object from, Object to) {
1288         return new Value.String(s).substring(from, to);
1289     }
1290     /**
1291      * <p>Returns a copy of string, with each upper-case letter converted to its lower-case 
1292      * equivalent, if it has one.</p>
1293      * @param s The current string.
1294      * @return A copy of string, with each upper-case letter converted to its lower-case 
1295      * equivalent, if it has one.
1296      * @see #toLocaleLowerCase(js.StringLike)
1297      * @see #toLocaleUpperCase(js.StringLike)
1298      * @see #toUpperCase(js.StringLike)
1299      * @see js.StringLike#toLowerCase()
1300      * @since 1.0
1301      */
1302     public static final String toLowerCase(StringLike s) {
1303         return s.toLowerCase();
1304     }
1305     /**
1306      * <p>Returns a copy of string, with each upper-case letter converted to its lower-case 
1307      * equivalent, if it has one.</p>
1308      * @param s The current string.
1309      * @return A copy of string, with each upper-case letter converted to its lower-case 
1310      * equivalent, if it has one.
1311      * @see #toLocaleLowerCase(String)
1312      * @see #toLocaleUpperCase(String)
1313      * @see #toUpperCase(String)
1314      * @see js.Value.String#toLowerCase()
1315      * @since 1.0
1316      */
1317     public static final String toLowerCase(String s) {
1318         return new Value.String(s).toLowerCase();
1319     }
1320     /**
1321      * <p>Returns a copy of string, with each lower-case letter converted to its upper-case 
1322      * equivalent, if it has one.</p>
1323      * @param s The current string.
1324      * @return A copy of string, with each lower-case letter converted to its upper-case 
1325      * equivalent, if it has one.
1326      * @see #toLocaleLowerCase(js.StringLike)
1327      * @see #toLocaleUpperCase(js.StringLike)
1328      * @see #toLowerCase(js.StringLike)
1329      * @see js.StringLike#toUpperCase()
1330      * @since 1.0
1331      */
1332     public static final String toUpperCase(StringLike s) {
1333         return s.toUpperCase();
1334     }
1335     /**
1336      * <p>Returns a copy of string, with each lower-case letter converted to its upper-case 
1337      * equivalent, if it has one.</p>
1338      * @param s The current string.
1339      * @return A copy of string, with each lower-case letter converted to its upper-case 
1340      * equivalent, if it has one.
1341      * @see #toLocaleLowerCase(String)
1342      * @see #toLocaleUpperCase(String)
1343      * @see #toLowerCase(String)
1344      * @see js.Value.String#toUpperCase()
1345      * @since 1.0
1346      */
1347     public static final String toUpperCase(String s) {
1348         return new Value.String(s).toUpperCase();
1349     }
1350     /**
1351      * <p>Returns a copy of the current string, converted to lower-case letters in a 
1352      * locale-specific way. Only a few languages, such as Turkish, have locale-specific 
1353      * case mappings, so this method usually returns the same value as 
1354      * {@link #toLowerCase(js.StringLike)}.</p>
1355      * @param s The current string.
1356      * @return A copy of the current string, converted to lower-case letters in a 
1357      * locale-specific way.
1358      * @see #toLocaleUpperCase(js.StringLike)
1359      * @see #toLowerCase(js.StringLike)
1360      * @see #toUpperCase(js.StringLike)
1361      * @see js.StringLike#toLocaleLowerCase()
1362      * @since 1.0
1363      */
1364     public static final String toLocaleLowerCase(StringLike s) {
1365         return s.toLocaleLowerCase();
1366     }
1367     /**
1368      * <p>Returns a copy of the current string, converted to lower-case letters in a 
1369      * locale-specific way. Only a few languages, such as Turkish, have locale-specific 
1370      * case mappings, so this method usually returns the same value as 
1371      * {@link #toLowerCase(String)}.</p>
1372      * @param s The current string.
1373      * @return A copy of the current string, converted to lower-case letters in a 
1374      * locale-specific way.
1375      * @see #toLocaleUpperCase(String)
1376      * @see #toLowerCase(String)
1377      * @see #toUpperCase(String)
1378      * @see js.Value.String#toLocaleLowerCase()
1379      * @since 1.0
1380      */
1381     public static final String toLocaleLowerCase(String s) {
1382         return new Value.String(s).toLocaleLowerCase();
1383     }
1384     /**
1385      * <p>Returns a copy of the current string, converted to upper-case letters in a 
1386      * locale-specific way. Only a few languages, such as Turkish, have locale-specific 
1387      * case mappings, so this method usually returns the same value as 
1388      * {@link #toUpperCase(js.StringLike)}.</p>
1389      * @param s The current string.
1390      * @return A copy of the current string, converted to upper-case letters in a 
1391      * locale-specific way.
1392      * @see #toLocaleLowerCase(js.StringLike)
1393      * @see #toLowerCase(js.StringLike)
1394      * @see #toUpperCase(js.StringLike)
1395      * @see js.StringLike#toLocaleUpperCase()
1396      * @since 1.0
1397      */
1398     public static final String toLocaleUpperCase(StringLike s) {
1399         return s.toLocaleUpperCase();
1400     }
1401     /**
1402      * <p>Returns a copy of the current string, converted to upper-case letters in a 
1403      * locale-specific way. Only a few languages, such as Turkish, have locale-specific 
1404      * case mappings, so this method usually returns the same value as 
1405      * {@link #toUpperCase(String)}.</p>
1406      * @param s The current string.
1407      * @return A copy of the current string, converted to upper-case letters in a 
1408      * locale-specific way.
1409      * @see #toLocaleLowerCase(String)
1410      * @see #toLowerCase(String)
1411      * @see #toUpperCase(String)
1412      * @see js.Value.String#toLocaleUpperCase()
1413      * @since 1.0
1414      */
1415     public static final String toLocaleUpperCase(String s) {
1416         return new Value.String(s).toLocaleUpperCase();
1417     }
1418     private static interface TRIMRE {
1419         static final RegExpLike $ = Js.re("^\\s+|\\s+$", "g");
1420     }
1421     /**
1422      * <p>Trims whitespace from either end of the current string, leaving spaces within 
1423      * it intact.</p>
1424      * @param s The current string.
1425      * @return The trimmed string.
1426      * @since 1.0
1427      */
1428     public static final String trim(Object s) {
1429         return replace(Js.toString(s), TRIMRE.$, "");
1430     }
1431 }