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


Java StringTokenizer.nextToken方法代码示例

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


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

示例1: createLanguageTagSet

import java.util.StringTokenizer; //导入方法依赖的package包/类
protected Set<String> createLanguageTagSet(String category) {
    String supportedLocaleString = LocaleDataMetaInfo.getSupportedLocaleString(category);
    Set<String> tagset = new HashSet<>();
    StringTokenizer tokens = new StringTokenizer(supportedLocaleString);
    while (tokens.hasMoreTokens()) {
        String token = tokens.nextToken();
        if (token.equals("|")) {
            if (isNonENLangSupported()) {
                continue;
            }
            break;
        }
        tagset.add(token);
    }

    return tagset;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:JRELocaleProviderAdapter.java

示例2: matches

import java.util.StringTokenizer; //导入方法依赖的package包/类
public boolean matches(String host)
{
	nextmatch : for( List<String> match : matches )
	{
		StringTokenizer stok = new StringTokenizer(host, "."); //$NON-NLS-1$
		int j = 0;
		while( stok.hasMoreTokens() )
		{
			String ip = stok.nextToken();
			String tomatch = match.get(j++);
			if( tomatch.equals("*") ) //$NON-NLS-1$
			{
				continue;
			}

			if( !tomatch.equals(ip) )
			{
				continue nextmatch;
			}
		}
		return true;
	}
	return false;
}
 
开发者ID:equella,项目名称:Equella,代码行数:25,代码来源:HostMatcher.java

示例3: encodeUri

import java.util.StringTokenizer; //导入方法依赖的package包/类
/**
 * URL-encodes everything between "/"-characters.
 * Encodes spaces as '%20' instead of '+'.
 */
private String encodeUri( String uri )
{
        String newUri = "";
        StringTokenizer st = new StringTokenizer( uri, "/ ", true );
        while ( st.hasMoreTokens())
        {
                String tok = st.nextToken();
                if ( tok.equals( "/" ))
                        newUri += "/";
                else if ( tok.equals( " " ))
                        newUri += "%20";
                else
                {
                        newUri += URLEncoder.encode( tok );
                        // For Java 1.4 you'll want to use this instead:
                        // try { newUri += URLEncoder.encode( tok, "UTF-8" ); } catch ( java.io.UnsupportedEncodingException uee ) {}
                }
        }
        return newUri;
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:25,代码来源:NanoHTTPD.java

示例4: parseMimeTypes

import java.util.StringTokenizer; //导入方法依赖的package包/类
private String[] parseMimeTypes(String val) {
    int pos = val.indexOf(' ');
    //int lastPrintable;
    if (pos < 0) {
        // Maybe report/log this problem?
        //  "Last printable character not defined for encoding " +
        //  mimeName + " (" + val + ")" ...
        return new String[] { val };
        //lastPrintable = 0x00FF;
    }
    //lastPrintable =
    //    Integer.decode(val.substring(pos).trim()).intValue();
    StringTokenizer st =
            new StringTokenizer(val.substring(0, pos), ",");
    String[] values = new String[st.countTokens()];
    for (int i=0; st.hasMoreTokens(); i++) {
        values[i] = st.nextToken();
    }
    return values;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:Encodings.java

示例5: setProperty

import java.util.StringTokenizer; //导入方法依赖的package包/类
private void setProperty( String name, String value )
{
    if( name.equals( ORBConstants.ORB_INIT_REF_PROPERTY ) ) {
        // Value is <name>=<URL>
        StringTokenizer st = new StringTokenizer( value, "=" ) ;
        if (st.countTokens() != 2)
            throw new IllegalArgumentException() ;

        String refName = st.nextToken() ;
        String refValue = st.nextToken() ;

        resultProps.setProperty( name + "." + refName, refValue ) ;
    } else {
        resultProps.setProperty( name, value ) ;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:DataCollectorBase.java

示例6: tokenizeSchemaLocationStr

import java.util.StringTokenizer; //导入方法依赖的package包/类
public static boolean tokenizeSchemaLocationStr(String schemaStr, Map locations) {
    if (schemaStr!= null) {
        StringTokenizer t = new StringTokenizer(schemaStr, " \n\t\r");
        String namespace, location;
        while (t.hasMoreTokens()) {
            namespace = t.nextToken ();
            if (!t.hasMoreTokens()) {
                return false; // error!
            }
            location = t.nextToken();
            LocationArray la = ((LocationArray)locations.get(namespace));
            if(la == null) {
                la = new LocationArray();
                locations.put(namespace, la);
            }
            la.addLocation(location);
        }
    }
    return true;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:XMLSchemaLoader.java

示例7: camelize

import java.util.StringTokenizer; //导入方法依赖的package包/类
public static String camelize(final String value) {
  if (value == null || !value.contains("-")) {
    return value;
  }
  final StringTokenizer token = new StringTokenizer(value, "-");
  final StringBuilder str = new StringBuilder(token.nextToken());
  while (token.hasMoreTokens()) {
    final String s = token.nextToken();
    str.append(Character.toUpperCase(s.charAt(0))).append(s.substring(1));
  }
  return str.toString();
}
 
开发者ID:camunda,项目名称:camunda-bpm-swagger,代码行数:13,代码来源:StringHelper.java

示例8: escapeStringForXml

import java.util.StringTokenizer; //导入方法依赖的package包/类
public static String escapeStringForXml(String s) {
    StringTokenizer st = new StringTokenizer(s, "\"", true); //$NON-NLS-1$
    StringBuilder sb = new StringBuilder();
    while (st.hasMoreTokens()) {
        String token = st.nextToken();
        if ("\"".equals(token)) { //$NON-NLS-1$
            sb.append("&quot;"); //$NON-NLS-1$
        } else {
            sb.append(token);
        }
    }

    return sb.toString();
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:15,代码来源:StringUtility.java

示例9: ComputeNegPolarimots

import java.util.StringTokenizer; //导入方法依赖的package包/类
public int ComputeNegPolarimots(String tweet) throws FileNotFoundException, IOException, TreeTaggerException{
    int count=0;
    String lemme;
    StringTokenizer st = new StringTokenizer(tweet, " 	.,;:'\"|()?!-_/<>‘’“”…«»•&#{[|`^@]}$*%1234567890", false);
    while (st.hasMoreElements()){
        lemme=st.nextToken();
        if(lemme.contains("|")) lemme=lemme.split("|")[0];
        if (alNegPolarimots.contains(lemme)) count++;
    }
    return count;
}
 
开发者ID:amineabdaoui,项目名称:french-sentiment-classification,代码行数:12,代码来源:CalculAttributs.java

示例10: iterateSharedPackages

import java.util.StringTokenizer; //导入方法依赖的package包/类
private void iterateSharedPackages (File f, Set<String> myPkgs) throws IOException {
    try (JarFile file = new JarFile (f)) {
        Enumeration<JarEntry> en = file.entries ();
        LOOP: while(en.hasMoreElements()) {
            JarEntry e = en.nextElement();
            if (e.getName().endsWith ("/")) {
                continue;
            }
            if (e.getName().startsWith ("META-INF/")) {
                continue;
            }

            int last = e.getName().lastIndexOf('/');
            String pkg = last == -1 ? "" : e.getName().substring (0, last);
            myPkgs.add (pkg);
            log("Found package " + pkg + " in " + f, Project.MSG_DEBUG);
        }

        Manifest m = file.getManifest();
        if (m != null) {
            String value = m.getMainAttributes().getValue("Class-Path");
            if (value != null) {
                StringTokenizer tok = new StringTokenizer (value, " ");
                while (tok.hasMoreElements ()) {
                    File sub = new File(f.getParentFile(), tok.nextToken());
                    if (sub.isFile()) {
                        iterateSharedPackages (sub, myPkgs);
                    }
                }
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:ModuleDependencies.java

示例11: getSearchCriteriaList

import java.util.StringTokenizer; //导入方法依赖的package包/类
private SearchCriteriaList getSearchCriteriaList(String searchStr) {
    SearchCriteriaList searchList = new SearchCriteriaList();
    if (searchStr != null && searchStr.compareTo("*") != 0) {
        StringTokenizer searchCriTokenizer = new StringTokenizer(searchStr, SearchCriteria.WCHARS);
        while (searchCriTokenizer.hasMoreTokens()) {
            String prop = searchCriTokenizer.nextToken();
            if (!searchCriTokenizer.hasMoreTokens()) {
                break;
            }
            String binOp = searchCriTokenizer.nextToken();
            if (!searchCriTokenizer.hasMoreTokens()) {
                break;
            }
            String value = StringUtil.trim(searchCriTokenizer.nextToken(), "\"");
            String logOp = "";
            if (searchCriTokenizer.hasMoreTokens()) {
                logOp = searchCriTokenizer.nextToken();
            }
            SearchCriteria searchCri = new SearchCriteria();
            searchCri.setProperty(prop);
            searchCri.setOperation(binOp);
            searchCri.setValue(value);
            searchCri.setLogic(logOp);
            searchList.add(searchCri);
        }
    }
    return searchList;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:29,代码来源:ContentDirectory.java

示例12: ComputePosFEEL

import java.util.StringTokenizer; //导入方法依赖的package包/类
public int ComputePosFEEL(String tweet) throws FileNotFoundException, IOException, TreeTaggerException{
    int count=0;
    String lemme;
    StringTokenizer st = new StringTokenizer(tweet, " 	.,;:'\"|()?!-_/<>‘’“”…«»•&#{[|`^@]}$*%1234567890", false);
    while (st.hasMoreElements()){
        lemme=st.nextToken();
        if(lemme.contains("|")) lemme=lemme.split("|")[0];
        if (alPosFEEL.contains(lemme)) count++;
    }
    return count;
}
 
开发者ID:amineabdaoui,项目名称:french-sentiment-classification,代码行数:12,代码来源:CalculAttributs.java

示例13: useBypass

import java.util.StringTokenizer; //导入方法依赖的package包/类
@Override
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
	if (!target.isNpc())
	{
		return false;
	}
	
	if (!Config.ALLOW_WEAR)
	{
		return false;
	}
	
	try
	{
		final StringTokenizer st = new StringTokenizer(command, " ");
		st.nextToken();
		
		if (st.countTokens() < 1)
		{
			return false;
		}
		
		showWearWindow(activeChar, Integer.parseInt(st.nextToken()));
		return true;
	}
	catch (Exception e)
	{
		_log.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), e);
	}
	return false;
}
 
开发者ID:rubenswagner,项目名称:L2J-Global,代码行数:33,代码来源:Wear.java

示例14: compareThrowable

import java.util.StringTokenizer; //导入方法依赖的package包/类
/**
 * This method is used to compare the specified Throwable and possibly
 * the derived causes to the specified String argument.
 * The expected String argument format is :
 *      throwable_1;throwable_2;...;throwable_N
 * where throwable_i can be :
 *      - either a throwable class name
 *      - or the "*" character meaning several unknown throwable class names
 *      This character must be followed by a throwable class name
 */
static boolean compareThrowable(
        Throwable t,
        String expectedThrowable) {

    // First parse the expectedThrowable String
    StringTokenizer tokenizer = new StringTokenizer(expectedThrowable, ";");
    String token = null;

    try {
        while (tokenizer.hasMoreTokens()) {
            token = tokenizer.nextToken();
            if (!token.equals("*")) {
                if (!Class.forName(token).isInstance(t)) {
                    return false;
                }
            } else {
                token = tokenizer.nextToken();
                while (!Class.forName(token).isInstance(t)) {
                    t = t.getCause();
                    if (t == null) {
                        return false;
                    }
                }
            }
            t = t.getCause();
        }
    } catch (ClassNotFoundException cnfe) {
        String msg = "Expected throwable class(es) " + expectedThrowable +
            " cannot be located";
        System.out.println(msg);
        throw new IllegalArgumentException(msg);
    }
    return true;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:45,代码来源:Utils.java

示例15: setText

import java.util.StringTokenizer; //导入方法依赖的package包/类
/**
 * Set the text, decoded as pairs of involvee - involvement
 *
 * @param text
 */
public void setText(String text) {
    PairedTextEncodedStringNullTerminated.ValuePairs value = new PairedTextEncodedStringNullTerminated.ValuePairs();
    StringTokenizer stz = new StringTokenizer(text, "\0");

    while (stz.hasMoreTokens()) {
        String key = stz.nextToken();
        if (stz.hasMoreTokens()) {
            value.add(key, stz.nextToken());
        }

    }
    setObjectValue(DataTypes.OBJ_TEXT, value);
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:19,代码来源:FrameBodyTIPL.java


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