亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
蜜桃视频在线观看一区| 在线成人av影院| 中文字幕一区二区视频| 成人免费看黄yyy456| 中文字幕中文字幕中文字幕亚洲无线| 国产高清视频一区| 中文字幕一区二区视频| 91久久精品一区二区| 亚洲午夜久久久久久久久久久| 欧美调教femdomvk| 奇米一区二区三区| 欧美激情艳妇裸体舞| 色婷婷综合视频在线观看| 午夜欧美电影在线观看| 日韩欧美国产不卡| 成人精品免费视频| 亚洲午夜激情av| 精品国产一区二区精华| 国产大片一区二区| 亚洲精品成a人| 一本一道波多野结衣一区二区 | 国产丝袜美腿一区二区三区| 国产91丝袜在线播放九色| 国产精品毛片大码女人| 欧美在线你懂得| 久久丁香综合五月国产三级网站| 国产亚洲1区2区3区| 色婷婷精品久久二区二区蜜臂av | 国产综合一区二区| 亚洲激情av在线| 日韩精品一区二区三区中文不卡 | 久久成人免费网站| 国产精品久久久久天堂| 4438x亚洲最大成人网| 国产成人免费在线观看| 亚洲国产欧美日韩另类综合 | 欧美在线免费观看视频| 国内精品视频一区二区三区八戒| 中文字幕一区二区5566日韩| 欧美一二三在线| 99久久国产综合精品麻豆| 天堂成人免费av电影一区| 中文字幕巨乱亚洲| 日韩精品一区二区三区老鸭窝| 99riav久久精品riav| 麻豆91免费观看| 天天色 色综合| 亚洲美女在线一区| 中文字幕精品—区二区四季| 欧美大片在线观看一区| 欧美怡红院视频| 99麻豆久久久国产精品免费 | 91片黄在线观看| 久久99久久99| 亚洲国产va精品久久久不卡综合| 国产精品免费观看视频| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 亚洲乱码国产乱码精品精98午夜| 精品久久久影院| 欧美老女人第四色| 在线一区二区三区四区五区| 波多野结衣欧美| 国产激情偷乱视频一区二区三区| 精品一区二区三区的国产在线播放| 一区二区三区四区高清精品免费观看 | 老司机午夜精品| 偷拍日韩校园综合在线| 亚洲一区二区三区视频在线| 亚洲欧美日韩久久| 中文字幕不卡在线观看| 亚洲精品一区二区精华| 日韩欧美国产小视频| 日韩欧美国产一区在线观看| 日韩视频免费观看高清完整版| 欧美人体做爰大胆视频| 欧美精品久久一区| 欧美日韩国产首页在线观看| 欧美性视频一区二区三区| 色婷婷久久综合| 欧美日韩午夜在线视频| 欧美精品vⅰdeose4hd| 欧美日韩www| 欧美一级xxx| 久久综合九色综合欧美就去吻| 精品国产精品网麻豆系列| 精品国精品自拍自在线| 久久久久久久综合狠狠综合| 久久精品网站免费观看| 18涩涩午夜精品.www| 亚洲欧美日韩电影| 亚洲一区二区高清| 日本不卡视频一二三区| 国内精品视频666| 成人高清免费在线播放| 色综合久久综合网欧美综合网| 在线日韩一区二区| 欧美丰满少妇xxxxx高潮对白| 欧美一区二区三区四区在线观看| 日韩欧美在线1卡| 久久精品人人做| 日本在线播放一区二区三区| 日本v片在线高清不卡在线观看| 久久er精品视频| 成人av网站在线观看| 欧美午夜电影一区| 精品国精品自拍自在线| 国产精品久久久久aaaa樱花 | 亚洲国产毛片aaaaa无费看| 日本中文在线一区| 国产成人鲁色资源国产91色综 | 中文字幕一区二区三区在线不卡| 亚洲黄色免费网站| 蜜乳av一区二区| a亚洲天堂av| 日韩久久免费av| 亚洲人成网站精品片在线观看| 日韩电影一二三区| 国产麻豆91精品| 欧美在线999| 国产区在线观看成人精品| 亚洲国产成人va在线观看天堂| 国产一区二区在线观看免费| 色天天综合色天天久久| 精品国产乱码久久久久久久 | 91精品国产一区二区| 国产精品视频yy9299一区| 亚洲一区二区三区视频在线播放| 国产精品一区二区免费不卡| 欧美日韩美少妇| 国产精品萝li| 国产一区二区三区最好精华液| 在线免费精品视频| 日本一区二区免费在线观看视频 | 一区二区欧美视频| 国产福利一区二区| 91精品国产麻豆| 亚洲综合色噜噜狠狠| 国产精品一区二区三区乱码| 这里只有精品99re| 亚洲中国最大av网站| 不卡影院免费观看| 久久亚洲精华国产精华液| 极品少妇一区二区| 欧美精品亚洲二区| 亚洲另类春色校园小说| 成人av免费在线| 久久综合成人精品亚洲另类欧美 | 成人一级片在线观看| 日韩精品一区二区三区在线观看| 亚洲一级在线观看| 色偷偷成人一区二区三区91| 中文字幕av不卡| 国产91在线观看| 国产校园另类小说区| 国内成+人亚洲+欧美+综合在线| 91.com视频| 日韩制服丝袜av| 欧美电影一区二区| 丝袜亚洲精品中文字幕一区| 欧美日韩一区视频| 亚洲国产精品精华液网站| 欧美性色黄大片| 亚洲国产一区二区在线播放| 欧美亚洲动漫制服丝袜| 亚洲欧美激情小说另类| 一本大道av一区二区在线播放 | 亚洲成人一区二区在线观看| 色综合天天综合网天天看片| 亚洲欧美视频一区| 在线一区二区视频| 午夜精品久久久久久久久| 91精品国产综合久久久蜜臀图片| 舔着乳尖日韩一区| 欧美电影免费观看高清完整版在 | 91麻豆精品国产91久久久久| 天涯成人国产亚洲精品一区av| 欧美日韩成人在线| 日韩二区三区四区| 精品国产区一区| 国产精品99久久不卡二区| 亚洲国产成人在线| 99久久国产综合精品色伊 | 日韩av在线播放中文字幕| 91麻豆精品国产91久久久久久| 蜜桃视频第一区免费观看| 久久青草欧美一区二区三区| 福利视频网站一区二区三区| 最新欧美精品一区二区三区| 在线免费一区三区| 国产精品久久久久久久久晋中 | 亚洲韩国一区二区三区| 日韩一区二区三| 国产高清久久久| 亚洲人成网站精品片在线观看| 欧美日本韩国一区二区三区视频| 日韩av中文字幕一区二区 | 亚洲黄网站在线观看| 91精品在线麻豆| 懂色av一区二区三区免费看| 亚洲激情男女视频|