trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/nls/StringUtils.java [127:194]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  public static String stripMnemonic(String string)
  {
    if (string == null)
    {
      return null;
    }

    int length = string.length();

    // Single character (or empty) strings can't have a mnemonic
    if (length <= 1)
      return string;

    StringBuffer buffer = null;
    int i = 0;

    while (i < length)
    {
      int index = string.indexOf(_MNEMONIC_INDICATOR, i);

      // We've reached the append.  Append the rest of the
      // string to the buffer, if one exists, then exit
      if ((index < 0) || (index >= length - 1))
      {
        if (buffer != null)
          buffer.append(string.substring(i));

        break;
      }

      if (buffer == null)
      {
        // If the string starts with an ampersand, but not a double
        // ampersand, then we just want to return
        // stripMnemonic(string.substring(1)).  This is basically
        // what we do here, only I've optimized the tail recursion away.
        if ((index == 0) && (string.charAt(1) != _MNEMONIC_INDICATOR))
        {
          string = string.substring(1);
          length--;
          continue;
        }
        else
        {
          // Allocate the buffer.  We can reserve only space
          // (length - 1), because, by now, we know there's at least
          // 1 ampersand
          buffer = new StringBuffer(length - 1);
        }
      }

      // Append the bits of the string before the ampersand
      buffer.append(string.substring(i, index));

      // And append the character after the ampersand
      buffer.append(string.charAt(index + 1));

      // And skip to after that character
      i = index + 2;
    }

    // If we never allocated a buffer, then there's no mnemonic
    // at all, and we can just return the whole string
    if (buffer == null)
      return string;

    return new String(buffer);
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/image/xml/parse/BaseImageProviderRequestParser.java [415:482]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  static String __stripMnemonic(String string)
  {
    if (string == null)
    {
      return null;
    }

    int length = string.length();

    // Single character (or empty) strings can't have a mnemonic
    if (length <= 1)
      return string;

    StringBuffer buffer = null;
    int i = 0;

    while (i < length)
    {
      int index = string.indexOf(_MNEMONIC_INDICATOR, i);

      // We've reached the append.  Append the rest of the
      // string to the buffer, if one exists, then exit
      if ((index < 0) || (index >= length - 1))
      {
        if (buffer != null)
          buffer.append(string.substring(i));

        break;
      }

      if (buffer == null)
      {
        // If the string starts with an ampersand, but not a double
        // ampersand, then we just want to return
        // stripMnemonic(string.substring(1)).  This is basically
        // what we do here, only I've optimized the tail recursion away.
        if ((index == 0) && (string.charAt(1) != _MNEMONIC_INDICATOR))
        {
          string = string.substring(1);
          length--;
          continue;
        }
        else
        {
          // Allocate the buffer.  We can reserve only space
          // (length - 1), because, by now, we know there's at least
          // 1 ampersand
          buffer = new StringBuffer(length - 1);
        }
      }

      // Append the bits of the string before the ampersand
      buffer.append(string.substring(i, index));

      // And append the character after the ampersand
      buffer.append(string.charAt(index + 1));

      // And skip to after that character
      i = index + 2;
    }

    // If we never allocated a buffer, then there's no mnemonic
    // at all, and we can just return the whole string
    if (buffer == null)
      return string;

    return new String(buffer);
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



