当前位置: 首页>>代码示例>>Java>>正文


Java StringCharacterIterator.first方法代码示例

本文整理汇总了Java中java.text.StringCharacterIterator.first方法的典型用法代码示例。如果您正苦于以下问题:Java StringCharacterIterator.first方法的具体用法?Java StringCharacterIterator.first怎么用?Java StringCharacterIterator.first使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.text.StringCharacterIterator的用法示例。


在下文中一共展示了StringCharacterIterator.first方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: valid

import java.text.StringCharacterIterator; //导入方法依赖的package包/类
private boolean valid(String input) {
	if ("".equals(input)) return true;

	boolean ret = true;
	it = new StringCharacterIterator(input);
	c = it.first();
	col = 1;
	if (!value()) {
		ret = error("value", 1);
	} else {
		skipWhiteSpace();
		if (c != CharacterIterator.DONE) {
			ret = error("end", col);
		}
	}

	return ret;
}
 
开发者ID:funtl,项目名称:framework,代码行数:19,代码来源:JSONValidator.java

示例2: valid

import java.text.StringCharacterIterator; //导入方法依赖的package包/类
private boolean valid(String input) {
    if ("".equals(input)) return true;

    boolean ret = true;
    it = new StringCharacterIterator(input);
    c = it.first();
    col = 1;
    if (!value()) {
        ret = error("value", 1);
    } else {
        skipWhiteSpace();
        if (c != CharacterIterator.DONE) {
            ret = error("end", col);
        }
    }

    return ret;
}
 
开发者ID:arccode,项目名称:wechat-pay-sdk,代码行数:19,代码来源:JSONValidator.java

示例3: valid

import java.text.StringCharacterIterator; //导入方法依赖的package包/类
private boolean valid(String input) {
    if ("".equals(input)) return true;
    
    boolean ret = true;
    it = new StringCharacterIterator(input);
    c = it.first();
    col = 1;
    if (!value()) {
        ret = error("value", 1);
    } else {
        skipWhiteSpace();
        if (c != CharacterIterator.DONE) {
            ret = error("end", col);
        }
    }
    
    return ret;
}
 
开发者ID:wendal,项目名称:alipay-sdk,代码行数:19,代码来源:JSONValidator.java

示例4: StringTokenizer

import java.text.StringCharacterIterator; //导入方法依赖的package包/类
StringTokenizer(String value, char delim) {
	string = value;
	// Loop on the characters counting the separators and remembering
	// their positions
	StringCharacterIterator sci = new StringCharacterIterator(string);
	char c = sci.first();
	while (c != CharacterIterator.DONE) {
		if (c == delim) {
			// Remember its position
			separatorPosition[tokens] = sci.getIndex();
			tokens++;

			// Resize the position array if needed
			if (tokens >= separatorPosition.length) {
				int[] copy = new int[separatorPosition.length * 10];
				System.arraycopy(separatorPosition, 0, copy, 0, separatorPosition.length);
				separatorPosition = copy;
			}
		}
		c = sci.next();
	}
	// Add one token: tokens = separatorCount + 1
	tokens++;
}
 
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:25,代码来源:Gpr.java

示例5: valid

import java.text.StringCharacterIterator; //导入方法依赖的package包/类
private boolean valid(String input) {
    if ("".equals(input)) { return true; }

    boolean ret = true;
    it = new StringCharacterIterator(input);
    c = it.first();
    col = 1;
    if (!value()) {
        ret = false;
    } else {
        skipWhiteSpace();
        if (c != CharacterIterator.DONE) {
            ret = false;
        }
    }

    return ret;
}
 
开发者ID:pengjianbo,项目名称:ToolsFinal,代码行数:19,代码来源:JsonValidator.java

示例6: setTagText

import java.text.StringCharacterIterator; //导入方法依赖的package包/类
/**
 * 	Set Tag Text
 *	@param text text
 *	@return Element
 */
public Element setTagText (String text)
{
	if (text != null && text.length() > 0)
	{
        StringCharacterIterator sci = new StringCharacterIterator(text);
        for (char c = sci.first(); c != CharacterIterator.DONE; c = sci.next())
        {
			int ii = c;
			if (ii > 255)
			{
				setFilterState(true);
				break;
			}
        }
	}
	return super.setTagText (text);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:23,代码来源:StringElement.java

示例7: process

import java.text.StringCharacterIterator; //导入方法依赖的package包/类
/**
     Perform the filtering operation.
 */
 public String process(String to_process)
 {
     if ( to_process == null || to_process.length() == 0 )
         return "";

     StringBuffer bs = new StringBuffer(to_process.length() + 50);
     StringCharacterIterator sci = new StringCharacterIterator(to_process);
     String tmp = null;

     for (char c = sci.first(); c != CharacterIterator.DONE; c = sci.next())
     {
         tmp = String.valueOf(c);

         if (hasAttribute(tmp))
             tmp = (String) this.get(tmp);

int ii = c;
if (ii > 255)
	tmp = "&#" + ii + ";";

         bs.append(tmp);
     }
     return(bs.toString());
 }
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:28,代码来源:CharacterFilter.java

示例8: escapeCharacter

import java.text.StringCharacterIterator; //导入方法依赖的package包/类
/**
 * 根据转义列表对字符串进行转义。.
 * 
 * @param source
 *            待转义的字符串
 * @param escapeCharMap
 *            转义列表
 * @return 转义后的字符串
 */
public static String escapeCharacter(String source, HashMap escapeCharMap) {
	if (source == null || source.length() == 0)
		return source;
	if (escapeCharMap.size() == 0)
		return source;
	StringBuffer sb = new StringBuffer();
	StringCharacterIterator sci = new StringCharacterIterator(source);
	for (char c = sci.first(); c != StringCharacterIterator.DONE; c = sci.next()) {
		String character = String.valueOf(c);
		if (escapeCharMap.containsKey(character))
			character = (String) escapeCharMap.get(character);
		sb.append(character);
	}
	return sb.toString();
}
 
开发者ID:8090boy,项目名称:gomall.la,代码行数:25,代码来源:StringUtil.java

示例9: valid

import java.text.StringCharacterIterator; //导入方法依赖的package包/类
private boolean valid(String input) {
    if ("".equals(input)) {
        return true;
    }

    boolean ret = true;
    it = new StringCharacterIterator(input);
    c = it.first();
    col = 1;
    if (!value()) {
        ret = error("value", 1);
    } else {
        skipWhiteSpace();
        if (c != CharacterIterator.DONE) {
            ret = error("end", col);
        }
    }

    return ret;
}
 
开发者ID:kuiwang,项目名称:my-dev,代码行数:21,代码来源:JSONValidator.java

示例10: imEscape

import java.text.StringCharacterIterator; //导入方法依赖的package包/类
private StringBuffer imEscape(String s) {
    StringBuffer stringbuffer = new StringBuffer();
    StringCharacterIterator stringcharacteriterator = new StringCharacterIterator(s);
    for (char c = stringcharacteriterator.first(); c != '\uFFFF'; c = stringcharacteriterator.next()) {
        switch (c) {
            case 34: // '"'
            case 36: // '$'
            case 40: // '('
            case 41: // ')'
            case 91: // '['
            case 92: // '\\'
            case 93: // ']'
            case 123: // '{'
            case 125: // '}'
                stringbuffer.append("\\");
                break;
        }
        stringbuffer.append(c);
    }

    stringbuffer.append("\"\0");
    return stringbuffer;
}
 
开发者ID:thammegowda,项目名称:charliebot,代码行数:24,代码来源:AliceAIM.java

示例11: filterXML

import java.text.StringCharacterIterator; //导入方法依赖的package包/类
private static String filterXML(String s) {
    if (s == null)
        return "";
    s = s.trim();
    if (s.equals(""))
        return "";
    StringBuffer stringbuffer = new StringBuffer(s.length());
    StringCharacterIterator stringcharacteriterator = new StringCharacterIterator(s);
    for (char c = stringcharacteriterator.first(); c != '\uFFFF'; c = stringcharacteriterator.next())
        if (c == '\t' || c == '\n' || c == '\r' || ' ' <= c && c <= '\uD7FF' || '\uE000' <= c && c <= '\uFFFD')
            stringbuffer.append(c);

    if (stringbuffer.length() > s.length())
        return stringbuffer.toString();
    else
        return s;
}
 
开发者ID:thammegowda,项目名称:charliebot,代码行数:18,代码来源:Toolkit.java

示例12: wordSplit

import java.text.StringCharacterIterator; //导入方法依赖的package包/类
public static ArrayList wordSplit(String s) {
    ArrayList arraylist = new ArrayList();
    int i = s.length();
    if (i == 0) {
        arraylist.add("");
        return arraylist;
    }
    int j = 0;
    StringCharacterIterator stringcharacteriterator = new StringCharacterIterator(s);
    for (char c = stringcharacteriterator.first(); c != '\uFFFF'; c = stringcharacteriterator.next())
        if (c == ' ') {
            int k = stringcharacteriterator.getIndex();
            arraylist.add(s.substring(j, k));
            j = k + 1;
        }

    if (j < s.length())
        arraylist.add(s.substring(j));
    return arraylist;
}
 
开发者ID:thammegowda,项目名称:charliebot,代码行数:21,代码来源:Toolkit.java

示例13: expandOverride

import java.text.StringCharacterIterator; //导入方法依赖的package包/类
private static String expandOverride(String pattern, String override) {

        if (override.indexOf('=') >= 0) {
            return override;
        }
        boolean inQuotes = false;
        char prevChar = ' ';
        StringBuilder result = new StringBuilder();

        StringCharacterIterator it = new StringCharacterIterator(pattern);

        for (char c = it.first(); c!= StringCharacterIterator.DONE; c = it.next()) {
            if ( c == QUOTE ) {
                inQuotes = !inQuotes;
                prevChar = c;
                continue;
            }
            if ( !inQuotes && c != prevChar ) {
                if (result.length() > 0) {
                    result.append(";");
                }
                result.append(c);
                result.append("=");
                result.append(override);
            }
            prevChar = c;
        }
        return result.toString();
    }
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:30,代码来源:Calendar.java

示例14: leftPad

import java.text.StringCharacterIterator; //导入方法依赖的package包/类
private String leftPad(String stringToPad, String padder, Integer size) {

        final StringBuilder sb = new StringBuilder(size.intValue());
        final StringCharacterIterator sci = new StringCharacterIterator(padder);

        while (sb.length() < (size.intValue() - stringToPad.length())) {
            for (char ch = sci.first(); ch != CharacterIterator.DONE; ch = sci.next()) {
                if (sb.length() < (size.intValue() - stringToPad.length())) {
                    sb.insert(sb.length(), String.valueOf(ch));
                }
            }
        }

        return sb.append(stringToPad).toString();
    }
 
开发者ID:mgtechsoftware,项目名称:smockin,代码行数:16,代码来源:RestfulMockSortingUtils.java

示例15: replaceXMLCharacters

import java.text.StringCharacterIterator; //导入方法依赖的package包/类
/**
 * Replace any special xml characters with the appropiate escape sequences
 * required to be done for the actual element names
 * @param xmlData
 * @return
 */
public static String replaceXMLCharacters(String xmlData)
{
    StringBuffer sb = new StringBuffer();
    StringCharacterIterator sCI = new StringCharacterIterator(xmlData);
    for (char c = sCI.first(); c != CharacterIterator.DONE; c = sCI.next())
    {
        switch (c)
        {
            case'&':
                sb.append("&amp;");
                break;
            case'<':
                sb.append("&lt;");
                break;
            case'>':
                sb.append("&gt;");
                break;
            case'"':
                sb.append("&quot;");
                break;
            case'\'':
                sb.append("&apos;");
                break;


            default:
                sb.append(c);
        }
    }
    return sb.toString();
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:38,代码来源:XMLTagDisplayFormatter.java


注:本文中的java.text.StringCharacterIterator.first方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。