Package com.ibm.icu.util

Examples of com.ibm.icu.util.StringTokenizer


   *         extracting
   */
  public static String[] unpackStylePreferences(String preference) {
    String[] stylePrefs = new String[6];
    if (preference != null) {
      StringTokenizer st = new StringTokenizer(preference, STYLE_SEPARATOR);
      if (st.hasMoreTokens()) {
        String foreground = st.nextToken().trim();
        stylePrefs[0] = foreground;
      }
      else {
        stylePrefs[0] = NULL;
      }
      if (st.hasMoreTokens()) {
        String background = st.nextToken().trim();
        stylePrefs[1] = background;
      }
      else {
        stylePrefs[1] = NULL;
      }

      if (st.hasMoreTokens()) {
        String bold = st.nextToken().trim();
        stylePrefs[2] = Boolean.valueOf(bold).toString();
      }
      else {
        stylePrefs[2] = Boolean.FALSE.toString();
      }
      if (st.hasMoreTokens()) {
        String italic = st.nextToken().trim();
        stylePrefs[3] = Boolean.valueOf(italic).toString();
      }
      else {
        stylePrefs[3] = Boolean.FALSE.toString();
      }
      if (st.hasMoreTokens()) {
        String strikethrough = st.nextToken().trim();
        stylePrefs[4] = Boolean.valueOf(strikethrough).toString();
      }
      else {
        stylePrefs[4] = Boolean.FALSE.toString();
      }
      if (st.hasMoreTokens()) {
        String underline = st.nextToken().trim();
        stylePrefs[5] = Boolean.valueOf(underline).toString();
      }
      else {
        stylePrefs[5] = Boolean.FALSE.toString();
      }
View Full Code Here


   */
  private String getMimeTypeFromContentTypeValue(String contentTypeValue) {
    if (contentTypeValue == null)
      return null;
    String cleanContentTypeValue = StringUtils.stripNonLetterDigits(contentTypeValue);
    StringTokenizer tokenizer = new StringTokenizer(cleanContentTypeValue, ";= \t\n\r\f"); //$NON-NLS-1$
    int tLen = tokenizer.countTokens();
    // if contains encoding should have three tokens, the mimetype, the
    // word 'charset', and the encoding value
    String[] tokens = new String[tLen];
    int j = 0;
    while (tokenizer.hasMoreTokens()) {
      tokens[j] = tokenizer.nextToken();
      j++;
    }
    //
    // Following is the common form for target expression
    // <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
View Full Code Here

    // get indent after 2nd line break
    StringBuffer textAfter = new StringBuffer();
    // will this work on mac?
    textBefore = textBefore.replaceAll("\r", ""); //$NON-NLS-1$ //$NON-NLS-2$
    StringTokenizer st = new StringTokenizer(textBefore, "\n", true); //$NON-NLS-1$
    while (st.hasMoreTokens()) {
      String tok = st.nextToken();
      if (tok.equals("\n")) { //$NON-NLS-1$
        textAfter.append(delim);
      }
      else {
        // prepend each line w/ specified indent
View Full Code Here

   * @param priorities
   */
  private void loadTagsAndPrioritiesFrom(String tagString, String priorityString) {
    String[] tags = StringUtils.unpack(tagString);

    StringTokenizer toker = null;
    List list = new ArrayList();

    toker = new StringTokenizer(priorityString, ","); //$NON-NLS-1$
    while (toker.hasMoreTokens()) {
      Integer number = null;
      try {
        number = Integer.valueOf(toker.nextToken());
      }
      catch (NumberFormatException e) {
        number = new Integer(IMarker.PRIORITY_NORMAL);
      }
      list.add(number);
View Full Code Here

      for (int i = 0; i < elements.length; i++) {
        final IConfigurationElement element = elements[i];
        final String contentType = element.getAttribute("contentType"); //$NON-NLS-1$
        final String pattern = element.getAttribute("pattern"); //$NON-NLS-1$
        if (pattern != null && contentType != null) {
          final StringTokenizer tokenizer = new StringTokenizer(pattern, ","); //$NON-NLS-1$
          Set patterns = (Set) fPatterns.get(contentType);
          if (patterns == null) {
            patterns = new HashSet(0);
            fPatterns.put(contentType, patterns);
          }

          while (tokenizer.hasMoreTokens()) {
            String token = tokenizer.nextToken();
            token = token.trim();
            if (token.length() > 0) {
              patterns.add(token);
            }
          }
View Full Code Here

   * @param priorities
   */
  private void loadTagsAndPrioritiesFrom(String tagString, String priorityString) {
    String[] tags = StringUtils.unpack(tagString);

    StringTokenizer toker = null;
    List list = new ArrayList();

    toker = new StringTokenizer(priorityString, ","); //$NON-NLS-1$
    while (toker.hasMoreTokens()) {
      Integer number = null;
      try {
        number = Integer.valueOf(toker.nextToken());
      }
      catch (NumberFormatException e) {
        number = new Integer(IMarker.PRIORITY_NORMAL);
      }
      list.add(number);
View Full Code Here

  public void addAnnotation(Annotation annotation) {
    String spec = annotation.getSpec();
    if (spec != null) {
      list.add(annotation);
      StringTokenizer st = new StringTokenizer(spec, "[]|\t\n\r\f "); //$NON-NLS-1$
      while (st.hasMoreTokens()) {
        String cmNodeSpec = st.nextToken();
        addAnnotationForCMNodeSpec(cmNodeSpec, annotation);
      }
    }
  }
View Full Code Here

      if (factoryClass != null && filenameExtensions != null)
      {
        try
        {
          CMDocumentFactoryDescriptor descriptor = new CMDocumentFactoryDescriptor(element);
          for (StringTokenizer st = new StringTokenizer(filenameExtensions, ","); st.hasMoreTokens(); ) //$NON-NLS-1$
          {
            String token = st.nextToken().trim();
      registry.putFactory(token, descriptor)
          }        
        }
        catch (Exception e)
        {
View Full Code Here

   * Takes a single string of the form "a/b/c" and ensures that that
   * structure exists below the head element, down through 'c', and returns
   * the element 'c'.
   ************************************************************************/
  private Node getNode(Node node, String name) {
    StringTokenizer tokenizer = new StringTokenizer(name, "/"); //$NON-NLS-1$
    String token = null;
    while (tokenizer.hasMoreTokens()) {
      token = tokenizer.nextToken();
      if (getNamedChild(node, token) == null)
        node.appendChild(document.createElement(token));
      node = getNamedChild(node, token);
    }
    return node;
View Full Code Here

  {
  }

  public void visitXSISchemaLocationAttribute(Attr attr, String value)
  {
    StringTokenizer st = new StringTokenizer(value);         
    while (true)
    {
      String nsURI = st.hasMoreTokens() ? st.nextToken() : null;
      String locationHint = st.hasMoreTokens() ? st.nextToken() : null;           
      if (nsURI != null && locationHint != null)
      {   
        visitXSISchemaLocationValuePair(nsURI, locationHint);         
      }
      else
View Full Code Here

TOP

Related Classes of com.ibm.icu.util.StringTokenizer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.