亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? stringutils.java

?? 這是學習Java必須讀懂兩套源代碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/**
 * $RCSfile: StringUtils.java,v $
 * $Revision: 1.11.2.3 $
 * $Date: 2001/03/06 16:38:31 $
 *
 * Copyright (C) 2000 CoolServlets.com. All rights reserved.
 *
 * ===================================================================
 * The Apache Software License, Version 1.1
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by
 *        CoolServlets.com (http://www.Yasna.com)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Jive" and "CoolServlets.com" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please
 *    contact webmaster@Yasna.com.
 *
 * 5. Products derived from this software may not be called "Jive",
 *    nor may "Jive" appear in their name, without prior written
 *    permission of CoolServlets.com.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL COOLSERVLETS.COM OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of CoolServlets.com. For more information
 * on CoolServlets.com, please see <http://www.Yasna.com>.
 */

package com.Yasna.util;

import java.security.*;
import java.text.*;
import java.util.*;

/**
 * Utility class to peform common String manipulation algorithms.
 */
public class StringUtils {

    /**
     * Initialization lock for the whole class. Init's only happen once per
     * class load so this shouldn't be a bottleneck.
     */
    private static Object initLock = new Object();

    /**
     * Replaces all instances of oldString with newString in line.
     *
     * @param line the String to search to perform replacements on
     * @param oldString the String that should be replaced by newString
     * @param newString the String that will replace all instances of oldString
     *
     * @return a String will all instances of oldString replaced by newString
     */
    public static final String replace( String line, String oldString, String newString )
    {
        if (line == null) {
            return null;
        }
        int i=0;
        if ( ( i=line.indexOf( oldString, i ) ) >= 0 ) {
            char [] line2 = line.toCharArray();
            char [] newString2 = newString.toCharArray();
            int oLength = oldString.length();
            StringBuffer buf = new StringBuffer(line2.length);
            buf.append(line2, 0, i).append(newString2);
            i += oLength;
            int j = i;
            while( ( i=line.indexOf( oldString, i ) ) > 0 ) {
                buf.append(line2, j, i-j).append(newString2);
                i += oLength;
                j = i;
            }
            buf.append(line2, j, line2.length - j);
            return buf.toString();
        }
        return line;
    }

    /**
     * Replaces all instances of oldString with newString in line with the
     * added feature that matches of newString in oldString ignore case.
     *
     * @param line the String to search to perform replacements on
     * @param oldString the String that should be replaced by newString
     * @param newString the String that will replace all instances of oldString
     *
     * @return a String will all instances of oldString replaced by newString
     */
    public static final String replaceIgnoreCase(String line, String oldString,
            String newString)
    {
        if (line == null) {
            return null;
        }
        String lcLine = line.toLowerCase();
        String lcOldString = oldString.toLowerCase();
        int i=0;
        if ( ( i=lcLine.indexOf( lcOldString, i ) ) >= 0 ) {
            char [] line2 = line.toCharArray();
            char [] newString2 = newString.toCharArray();
            int oLength = oldString.length();
            StringBuffer buf = new StringBuffer(line2.length);
            buf.append(line2, 0, i).append(newString2);
            i += oLength;
            int j = i;
            while( ( i=lcLine.indexOf( lcOldString, i ) ) > 0 ) {
                buf.append(line2, j, i-j).append(newString2);
                i += oLength;
                j = i;
            }
            buf.append(line2, j, line2.length - j);
            return buf.toString();
        }
        return line;
    }

   /**
    * Replaces all instances of oldString with newString in line.
    * The count Integer is updated with number of replaces.
    *
    * @param line the String to search to perform replacements on
    * @param oldString the String that should be replaced by newString
    * @param newString the String that will replace all instances of oldString
    *
    * @return a String will all instances of oldString replaced by newString
    */
    public static final String replace( String line, String oldString,
            String newString, int[] count)
    {
        if (line == null) {
            return null;
        }
        int i=0;
        if ( ( i=line.indexOf( oldString, i ) ) >= 0 ) {
            int counter = 0;
            counter++;
            char [] line2 = line.toCharArray();
            char [] newString2 = newString.toCharArray();
            int oLength = oldString.length();
            StringBuffer buf = new StringBuffer(line2.length);
            buf.append(line2, 0, i).append(newString2);
            i += oLength;
            int j = i;
            while( ( i=line.indexOf( oldString, i ) ) > 0 ) {
                counter++;
                buf.append(line2, j, i-j).append(newString2);
                i += oLength;
                j = i;
            }
            buf.append(line2, j, line2.length - j);
            count[0] = counter;
            return buf.toString();
        }
        return line;
    }

    /**
     * This method takes a string which may contain HTML tags (ie, &lt;b&gt;,
     * &lt;table&gt;, etc) and converts the '&lt'' and '&gt;' characters to
     * their HTML escape sequences.
     *
     * @param input the text to be converted.
     * @return the input string with the characters '&lt;' and '&gt;' replaced
     *  with their HTML escape sequences.
     */
    public static final String escapeHTMLTags( String input ) {
        //Check if the string is null or zero length -- if so, return
        //what was sent in.
        if( input == null || input.length() == 0 ) {
            return input;
        }
        //Use a StringBuffer in lieu of String concatenation -- it is
        //much more efficient this way.
        StringBuffer buf = new StringBuffer(input.length());
        char ch = ' ';
        for( int i=0; i<input.length(); i++ ) {
            ch = input.charAt(i);
            if( ch == '<' ) {
                buf.append("&lt;");
            }
            else if( ch == '>' ) {
                buf.append("&gt;");
            }
            else {
                buf.append( ch );
            }
        }
        return buf.toString();
    }

    /**
     * Used by the hash method.
     */
    private static MessageDigest digest = null;

    /**
     * Hashes a String using the Md5 algorithm and returns the result as a
     * String of hexadecimal numbers. This method is synchronized to avoid
     * excessive MessageDigest object creation. If calling this method becomes
     * a bottleneck in your code, you may wish to maintain a pool of
     * MessageDigest objects instead of using this method.
     * <p>
     * A hash is a one-way function -- that is, given an
     * input, an output is easily computed. However, given the output, the
     * input is almost impossible to compute. This is useful for passwords
     * since we can store the hash and a hacker will then have a very hard time
     * determining the original password.
     * <p>
     * In Jive, every time a user logs in, we simply
     * take their plain text password, compute the hash, and compare the
     * generated hash to the stored hash. Since it is almost impossible that
     * two passwords will generate the same hash, we know if the user gave us
     * the correct password or not. The only negative to this system is that
     * password recovery is basically impossible. Therefore, a reset password
     * method is used instead.
     *
     * @param data the String to compute the hash of.
     * @return a hashed version of the passed-in String
     */
    public synchronized static final String hash(String data) {
        if (digest == null) {
            try {
                digest = MessageDigest.getInstance("MD5");
            }
            catch (NoSuchAlgorithmException nsae) {
                System.err.println("Failed to load the MD5 MessageDigest. " +
                "Jive will be unable to function normally.");
                nsae.printStackTrace();
            }
        }
        //Now, compute hash.
        digest.update(data.getBytes());
        return toHex(digest.digest());
    }

    /**
     * Turns an array of bytes into a String representing each byte as an
     * unsigned hex number.
     * <p>
     * Method by Santeri Paavolainen, Helsinki Finland 1996<br>
     * (c) Santeri Paavolainen, Helsinki Finland 1996<br>
     * Distributed under LGPL.
     *
     * @param hash an rray of bytes to convert to a hex-string
     * @return generated hex string
     */
    public static final String toHex (byte hash[]) {
        StringBuffer buf = new StringBuffer(hash.length * 2);
        int i;

        for (i = 0; i < hash.length; i++) {
            if (((int) hash[i] & 0xff) < 0x10) {
                buf.append("0");
            }
            buf.append(Long.toString((int) hash[i] & 0xff, 16));
        }
        return buf.toString();
    }

    /**
     * Converts a line of text into an array of lower case words. Words are
     * delimited by the following characters: , .\r\n:/\+
     * <p>
     * In the future, this method should be changed to use a
     * BreakIterator.wordInstance(). That class offers much more fexibility.
     *
     * @param text a String of text to convert into an array of words
     * @return text broken up into an array of words.
     */
    public static final String [] toLowerCaseWordArray(String text) {
        if (text == null || text.length() == 0) {
                return new String[0];
        }
        StringTokenizer tokens = new StringTokenizer(text, " ,\r\n.:/\\+");

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区三区免费在线看| 国产精品高潮呻吟久久| 日韩欧美精品在线| 欧美二区在线观看| 欧美日韩五月天| 欧美片在线播放| 欧美群妇大交群中文字幕| 在线播放亚洲一区| 欧美一区二区三区在线视频| 欧美精品一二三| 日韩一区二区在线观看视频| 欧美一区三区四区| 日韩视频在线你懂得| 欧美成人a∨高清免费观看| 欧美成人国产一区二区| 久久亚洲欧美国产精品乐播| 中文字幕不卡的av| ...av二区三区久久精品| 亚洲天天做日日做天天谢日日欢 | 成人性生交大合| 成人中文字幕电影| 91美女福利视频| 欧美视频日韩视频在线观看| 在线成人小视频| 久久精品一级爱片| 日韩毛片一二三区| 午夜欧美视频在线观看| 久久国产剧场电影| 国产精品99久久久久久久女警| 成人国产精品免费网站| 欧洲av一区二区嗯嗯嗯啊| 91精品午夜视频| 国产偷国产偷亚洲高清人白洁| 中文字幕一区二区5566日韩| 亚洲国产精品自拍| 加勒比av一区二区| av电影在线观看一区| 911精品产国品一二三产区| 久久先锋影音av鲁色资源网| 一区在线播放视频| 视频一区免费在线观看| 国产suv一区二区三区88区| 色欧美88888久久久久久影院| 日韩视频一区二区三区在线播放| 国产精品午夜久久| 亚州成人在线电影| 国产成人精品亚洲日本在线桃色| 91美女在线看| 久久一二三国产| 亚洲美女区一区| 国产一区二区0| 欧美视频在线观看一区| 国产亚洲欧美色| 亚洲成人av在线电影| 丰满亚洲少妇av| 91精品视频网| 亚洲女爱视频在线| 激情久久久久久久久久久久久久久久| 99国产欧美另类久久久精品| 日韩三级av在线播放| 日韩美女视频一区二区| 狠狠色狠狠色综合| 欧美日韩亚洲另类| 国产精品久久一卡二卡| 捆绑调教一区二区三区| 在线看国产一区二区| 国产亚洲精品福利| 蜜桃av噜噜一区二区三区小说| 91在线高清观看| 国产女人18毛片水真多成人如厕 | 国产精品乱码人人做人人爱| 美女在线视频一区| 欧洲精品一区二区| 国产精品初高中害羞小美女文| 久久国产欧美日韩精品| 欧美三级中文字幕在线观看| 亚洲免费毛片网站| 成人小视频免费观看| 精品黑人一区二区三区久久| 亚洲狠狠爱一区二区三区| 91在线播放网址| 国产精品久久毛片av大全日韩| 国内精品久久久久影院一蜜桃| 日韩一区二区在线看| 午夜精品一区二区三区免费视频| 一本久久a久久免费精品不卡| 日本一区二区三区电影| 国产一本一道久久香蕉| 精品日韩一区二区| 美女性感视频久久| 欧美日本一区二区三区四区| 亚洲激情一二三区| 日本电影欧美片| 亚洲视频在线观看三级| av午夜一区麻豆| 中文字幕欧美日韩一区| 国产大陆精品国产| 国产日韩欧美在线一区| 国产精品一区不卡| 久久精品欧美一区二区三区麻豆 | 欧美三级午夜理伦三级中视频| 亚洲欧美乱综合| 日本韩国欧美在线| 亚洲欧美一区二区不卡| 色呦呦国产精品| 亚洲天堂久久久久久久| 色丁香久综合在线久综合在线观看| 国产精品传媒视频| 色综合久久久久久久久久久| 亚洲精品视频自拍| 欧美一a一片一级一片| 亚洲国产成人va在线观看天堂| 欧美亚洲精品一区| 午夜视频一区在线观看| 555www色欧美视频| 久久成人精品无人区| 久久综合资源网| 国产91精品精华液一区二区三区 | 亚洲成人免费视| 91精品国产综合久久精品| 美女视频黄 久久| 久久综合久久综合九色| 成人少妇影院yyyy| 亚洲精品国产视频| 欧美三级电影在线观看| 麻豆成人久久精品二区三区红 | 欧美日韩精品是欧美日韩精品| 午夜精品aaa| 欧美岛国在线观看| 国产精品亚洲一区二区三区妖精| 中日韩av电影| 在线免费观看一区| 日韩电影免费一区| 国产欧美日本一区二区三区| 色综合久久久久网| 老司机精品视频导航| 国产精品乱人伦中文| 欧美日韩国产成人在线91| 另类欧美日韩国产在线| 欧美国产日韩一二三区| 91国偷自产一区二区开放时间 | 午夜视黄欧洲亚洲| 精品国产免费人成电影在线观看四季 | 中文字幕在线不卡视频| 欧美日韩一区二区欧美激情| 韩国精品一区二区| 亚洲日本丝袜连裤袜办公室| 91精品国产91热久久久做人人| 国产夫妻精品视频| 亚洲永久精品大片| 久久午夜羞羞影院免费观看| 91传媒视频在线播放| 国产真实乱对白精彩久久| 一区二区三区欧美激情| 欧美videos中文字幕| 91视频在线观看免费| 久久99精品久久久久| 一区二区三区免费在线观看| 国产香蕉久久精品综合网| 欧美视频中文字幕| 岛国av在线一区| 日本中文一区二区三区| 国产精品免费丝袜| 日韩欧美综合在线| 欧美性淫爽ww久久久久无| 国v精品久久久网| 日本美女视频一区二区| 一区二区三区**美女毛片| 精品国产乱码久久| 欧美日韩视频不卡| jlzzjlzz欧美大全| 国产一区二区看久久| 丝袜亚洲精品中文字幕一区| 国产精品久久久久久久岛一牛影视 | 日本韩国一区二区三区视频| 国产大陆亚洲精品国产| 久久精品国产99| 日韩在线一二三区| 一区二区三区四区五区视频在线观看 | 欧美刺激脚交jootjob| 欧美日韩亚洲高清一区二区| 91在线观看美女| av在线一区二区三区| 国产精品一区一区| 秋霞午夜鲁丝一区二区老狼| 亚洲尤物在线视频观看| 中文字幕一区二区不卡| 国产欧美一区二区精品仙草咪| 欧美成人艳星乳罩| 91精品国产综合久久蜜臀| 欧美天堂一区二区三区| 色综合久久综合网| 91在线观看成人| 不卡一区在线观看| 国产91色综合久久免费分享| 国产在线精品免费| 久久www免费人成看片高清| 日韩高清在线不卡| 日韩精品一二区| 日韩精品国产精品|