⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stringtools.html

📁 java base64
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<DT><B>Returns:</B><DD>count of trailing matching characters, possibly 0.</DL>
</DD>
</DL>
<HR>

<A NAME="firstWord(java.lang.String)"><!-- --></A><H3>
firstWord</H3>
<PRE>
public static java.lang.String <B>firstWord</B>(java.lang.String&nbsp;s)</PRE>
<DL>
<DD>gets the first word of a String, delimited by space or the end of the string.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>s</CODE> - the input String
<DT><B>Returns:</B><DD>the first word of the String.</DL>
</DD>
</DL>
<HR>

<A NAME="indexOfWhiteSpace(java.lang.String)"><!-- --></A><H3>
indexOfWhiteSpace</H3>
<PRE>
public static int <B>indexOfWhiteSpace</B>(java.lang.String&nbsp;s)</PRE>
<DL>
<DD>find the first instance of whitespace (space, \n, \r, \t in a string.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>s</CODE> - string to scan
<DT><B>Returns:</B><DD>-1 if not found, offset relative to start of string where found</DL>
</DD>
</DL>
<HR>

<A NAME="indexOfWhiteSpace(java.lang.String, int)"><!-- --></A><H3>
indexOfWhiteSpace</H3>
<PRE>
public static int <B>indexOfWhiteSpace</B>(java.lang.String&nbsp;s,
                                    int&nbsp;startOffset)</PRE>
<DL>
<DD>find the first instance of whitespace (space, \n, \r, \t in a string.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>s</CODE> - string to scan<DD><CODE>startOffset</CODE> - where in string to start looking
<DT><B>Returns:</B><DD>-1 if not found, offset relative to start of string where found, not relative to startOffset.</DL>
</DD>
</DL>
<HR>

<A NAME="isEmpty(java.lang.String)"><!-- --></A><H3>
isEmpty</H3>
<PRE>
public static boolean <B>isEmpty</B>(java.lang.String&nbsp;s)</PRE>
<DL>
<DD>Is this string empty? In Java 1.6 + isEmpty is build in. Sun's version being an instance method cannot test for null.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>s</CODE> - String to be tested for emptiness.
<DT><B>Returns:</B><DD>true if the string is null or equal to the "" null string. or just blanks</DL>
</DD>
</DL>
<HR>

<A NAME="isLegal(java.lang.String, java.lang.String)"><!-- --></A><H3>
isLegal</H3>
<PRE>
public static boolean <B>isLegal</B>(java.lang.String&nbsp;candidate,
                              java.lang.String&nbsp;legalChars)</PRE>
<DL>
<DD>Ensure the string contains only legal characters.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>candidate</CODE> - string to test.<DD><CODE>legalChars</CODE> - characters than are legal for candidate.
<DT><B>Returns:</B><DD>true if candidate is formed only of chars from the legal set.</DL>
</DD>
</DL>
<HR>

<A NAME="isUnaccentedLowerCase(char)"><!-- --></A><H3>
isUnaccentedLowerCase</H3>
<PRE>
public static boolean <B>isUnaccentedLowerCase</B>(char&nbsp;c)</PRE>
<DL>
<DD>Check if char is plain ASCII lower case.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>c</CODE> - char to check.
<DT><B>Returns:</B><DD>true if char is in range a..z.<DT><B>See Also:</B><DD><CODE>Character.isLowerCase(char)</CODE></DL>
</DD>
</DL>
<HR>

<A NAME="isUnaccentedUpperCase(char)"><!-- --></A><H3>
isUnaccentedUpperCase</H3>
<PRE>
public static boolean <B>isUnaccentedUpperCase</B>(char&nbsp;c)</PRE>
<DL>
<DD>Check if char is plain ASCII upper case.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>c</CODE> - char to check.
<DT><B>Returns:</B><DD>true if char is in range A..Z.<DT><B>See Also:</B><DD><CODE>Character.isUpperCase(char)</CODE></DL>
</DD>
</DL>
<HR>

<A NAME="leftPad(java.lang.String, int, boolean)"><!-- --></A><H3>
leftPad</H3>
<PRE>
public static java.lang.String <B>leftPad</B>(java.lang.String&nbsp;s,
                                       int&nbsp;newLen,
                                       boolean&nbsp;chop)</PRE>
<DL>
<DD>Pads the string out to the given length by applying blanks on the left.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>s</CODE> - String to be padded/chopped.<DD><CODE>newLen</CODE> - length of new String desired.<DD><CODE>chop</CODE> - true if Strings longer than newLen should be truncated to newLen chars.
<DT><B>Returns:</B><DD>String padded on left/chopped to the desired length. Spaces are inserted on the left.</DL>
</DD>
</DL>
<HR>

<A NAME="parseDirtyLong(java.lang.String)"><!-- --></A><H3>
parseDirtyLong</H3>
<PRE>
public static long <B>parseDirtyLong</B>(java.lang.String&nbsp;numStr)</PRE>
<DL>
<DD>convert a String to a long. The routine is very forgiving. It ignores invalid chars, lead trail, embedded spaces, decimal points etc. Dash is treated as a minus sign.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>numStr</CODE> - String to be parsed.
<DT><B>Returns:</B><DD>long value of String with junk characters stripped.
<DT><B>Throws:</B>
<DD><CODE>java.lang.NumberFormatException</CODE> - if the number is too big to fit in a long.</DL>
</DD>
</DL>
<HR>

<A NAME="parseLongPennies(java.lang.String)"><!-- --></A><H3>
parseLongPennies</H3>
<PRE>
public static long <B>parseLongPennies</B>(java.lang.String&nbsp;numStr)</PRE>
<DL>
<DD>convert a String into long pennies. It ignores invalid chars, lead trail, embedded spaces. Dash is treated as a minus sign. 0 or 2 decimal places are permitted.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>numStr</CODE> - String to be parsed.
<DT><B>Returns:</B><DD>long pennies.
<DT><B>Throws:</B>
<DD><CODE>java.lang.NumberFormatException</CODE> - if the number is too big to fit in a long.</DL>
</DD>
</DL>
<HR>

<A NAME="penniesToString(long)"><!-- --></A><H3>
penniesToString</H3>
<PRE>
public static java.lang.String <B>penniesToString</B>(long&nbsp;pennies)</PRE>
<DL>
<DD>Print dollar currency, stored internally as scaled int. convert pennies to a string with a decorative decimal point.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>pennies</CODE> - long amount in pennies.
<DT><B>Returns:</B><DD>amount with decorative decimal point, but no lead $.</DL>
</DD>
</DL>
<HR>

<A NAME="pluck(java.lang.String)"><!-- --></A><H3>
pluck</H3>
<PRE>
public static int <B>pluck</B>(java.lang.String&nbsp;s)</PRE>
<DL>
<DD>Extracts a number from a string, returns 0 if malformed.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>s</CODE> - String containing the integer.
<DT><B>Returns:</B><DD>binary integer.</DL>
</DD>
</DL>
<HR>

<A NAME="quoteSQL(java.lang.String)"><!-- --></A><H3>
quoteSQL</H3>
<PRE>
public static java.lang.String <B>quoteSQL</B>(java.lang.String&nbsp;sql)</PRE>
<DL>
<DD>used to prepare SQL string literals by doubling each embedded ' and wrapping in ' at each end. Further quoting is required to use the results in Java String literals. If you use PreparedStatement, then this method is not needed. The ' quoting is automatically handled for you.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>sql</CODE> - Raw SQL string literal
<DT><B>Returns:</B><DD>sql String literal enclosed in '</DL>
</DD>
</DL>
<HR>

<A NAME="removeHead(java.lang.String, java.lang.String)"><!-- --></A><H3>
removeHead</H3>
<PRE>
public static java.lang.String <B>removeHead</B>(java.lang.String&nbsp;s,
                                          java.lang.String&nbsp;head)</PRE>
<DL>
<DD>Remove an unwanted bit of text at the head end of a string if it is present. Case sensitive.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>s</CODE> - the string with the possibly wanted head. Will not be modified.<DD><CODE>head</CODE> - the characters you want to remove from the start of the string s if they are present.
<DT><B>Returns:</B><DD>s with the head removed if it is present, otherwise s unmodified.</DL>
</DD>
</DL>
<HR>

<A NAME="removeTail(java.lang.String, java.lang.String)"><!-- --></A><H3>
removeTail</H3>
<PRE>
public static java.lang.String <B>removeTail</B>(java.lang.String&nbsp;s,
                                          java.lang.String&nbsp;tail)</PRE>
<DL>
<DD>Remove an unwanted bit of text at the tail end of a string if it is present. Case sensitive.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>s</CODE> - the string with the possibly wanted tail. Will not be modified.<DD><CODE>tail</CODE> - the characters you want to remove from the end if they are present.
<DT><B>Returns:</B><DD>s with the tail removed if it is present, otherwise s unmodified.</DL>
</DD>
</DL>
<HR>

<A NAME="rep(char, int)"><!-- --></A><H3>
rep</H3>
<PRE>
public static java.lang.String <B>rep</B>(char&nbsp;c,
                                   int&nbsp;count)</PRE>
<DL>
<DD>Produce a String of a given repeating character.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>c</CODE> - the character to repeat<DD><CODE>count</CODE> - the number of times to repeat
<DT><B>Returns:</B><DD>String, e.g. rep('*',4) returns "****"</DL>
</DD>
</DL>
<HR>

<A NAME="rightPad(java.lang.String, int, boolean)"><!-- --></A><H3>
rightPad</H3>
<PRE>
public static java.lang.String <B>rightPad</B>(java.lang.String&nbsp;s,
                                        int&nbsp;newLen,
                                        boolean&nbsp;chop)</PRE>
<DL>
<DD>Pads the string out to the given length by applying blanks on the right.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>s</CODE> - String to be padded/chopped.<DD><CODE>newLen</CODE> - length of new String desired.<DD><CODE>chop</CODE> - true if Strings longer than newLen should be truncated to newLen chars.
<DT><B>Returns:</B><DD>String padded on right/chopped to the desired length. Spaces are inserted on the right.</DL>
</DD>
</DL>
<HR>

<A NAME="squish(java.lang.String)"><!-- --></A><H3>
squish</H3>
<PRE>
public static java.lang.String <B>squish</B>(java.lang.String&nbsp;s)</PRE>
<DL>
<DD>Remove all spaces from a String.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>s</CODE> - String to strip of blanks.
<DT><B>Returns:</B><DD>String with all blanks, lead/trail/embedded removed.<DT><B>See Also:</B><DD><A HREF="../../../com/mindprod/common11/StringTools.html#condense(java.lang.String)"><CODE>condense(String)</CODE></A></DL>
</DD>
</DL>
<HR>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -