Examples of StringBuilder


Examples of cli.System.Text.StringBuilder

        }
        else
        {
            ArrayList list = new ArrayList();
            String cmdline = Environment.get_CommandLine();
            StringBuilder sb = new StringBuilder();
            for(int i = 0; i < cmdline.length(); )
            {
                boolean quoted = cmdline.charAt(i) == '"';
                for(;;)
                {
                    while(i < cmdline.length() && cmdline.charAt(i) != ' ' && cmdline.charAt(i) != '"')
                    {
                        sb.Append(cmdline.charAt(i++));
                    }
                    if(i < cmdline.length() && cmdline.charAt(i) == '"')
                    {
                        if(quoted && i > 1 && cmdline.charAt(i - 1) == '"')
                        {
                            sb.Append('"');
                        }
                        i++;
                        while(i < cmdline.length() && cmdline.charAt(i) != '"')
                        {
                            sb.Append(cmdline.charAt(i++));
                        }
                        if(i < cmdline.length() && cmdline.charAt(i) == '"')
                        {
                            i++;
                        }
                        if(i < cmdline.length() && cmdline.charAt(i) != ' ')
                        {
                            continue;
                        }
                    }
                    break;
                }
                while(i < cmdline.length() && cmdline.charAt(i) == ' ')
                {
                    i++;
                }
                if(skip > 0)
                {
                    skip--;
                }
                else
                {
                    if(quoted)
                    {
                        list.Add(sb.ToString());
                    }
                    else
                    {
                        list.AddRange((ICollection)(Object)glob(sb.ToString()));
                    }
                }
                sb.set_Length(0);
            }
            return (String[])(Object)list.ToArray(Type.GetType("System.String"));
        }
    }
View Full Code Here

Examples of com.badlogic.gdx.utils.StringBuilder

    float oldScaleX = font.getScaleX();
    float oldScaleY = font.getScaleY();
    if (fontScaleX != 1 || fontScaleY != 1) font.setScale(fontScaleX, fontScaleY);

    float width = getWidth(), height = getHeight();
    StringBuilder text;
    if (ellipse && width < bounds.width) {
      float ellipseWidth = font.getBounds("...").width;
      text = tempText != null ? tempText : (tempText = new StringBuilder());
      text.setLength(0);
      if (width > ellipseWidth) {
        text.append(this.text, 0, font.computeVisibleGlyphs(this.text, 0, this.text.length, width - ellipseWidth));
        text.append("...");
      }
    } else
      text = this.text;

    Drawable background = style.background;
View Full Code Here

Examples of java.lang.StringBuilder

          int newssize = heraldNews.size();
          if(newssize==0){
            npc.say("My announcements list is empty.");
            return;
          }
          StringBuilder sb=new StringBuilder();
          sb.append("Here " + Grammar.isare(newssize) + " my current " + Grammar.plnoun(newssize,"announcement") + ": ");

         
          for(int i=0; i<newssize;i++){
            // will add 1 to position numbers to show position 0 as 1.
            logger.info("info: index "+Integer.toString(i));
            try {
            final int left = heraldNews.get(i).getLimit()/heraldNews.get(i).getInterval()-
                     heraldNews.get(i).getCounter();
            sb.append(" #"+Integer.toString(i+1)+". (left "+
                  Integer.toString(left)+" times): "+
                "#Every #"+Integer.toString(heraldNews.get(i).getInterval())+
                " #seconds #to #"+Integer.toString(heraldNews.get(i).getLimit())+
                " #seconds: \""+heraldNews.get(i).getNews()+"\"");
            } catch (IndexOutOfBoundsException ioobe) {
              logger.error("ReadNewsAction: size of heraldNews = "+
                  Integer.toString(newssize), ioobe);
            }
            if(i!=(newssize-1)){
              sb.append("; ");
            }
          }
          npc.say(sb.toString());
        }
View Full Code Here

Examples of java.lang.StringBuilder

          if(newssize==0){
            npc.say("My announcements list is empty.");
            return;
          }

          StringBuilder sb=new StringBuilder();
          sb.append("Here " + Grammar.isare(newssize) + " my current " + Grammar.plnoun(newssize,"announcement") + ": ");
         
          for(int i=0; i<newssize;i++){
            // will add 1 to position numbers to show position 0 as 1.
            logger.info("info: index "+Integer.toString(i));
            try {
            sb.append("\""+heraldNews.get(i).getNews()+"\"");
            } catch (IndexOutOfBoundsException ioobe) {
              logger.error("ReadNewsAction: size of heraldNews = "+
                  Integer.toString(newssize), ioobe);
            }
            if(i!=(newssize-1)){
              sb.append("; ");
            }
          }
          npc.say(sb.toString());
        }
View Full Code Here

Examples of java.lang.StringBuilder

  */

  public InputStream getPayload1()
      throws Exception {

    StringBuilder s = new StringBuilder();

    s.setLength(0);
    s.append("<html>\n");
    s.append("  <head>\n");
    s.append("    <title>This is a web page!</title>\n");
    s.append("  </head>\n");
    s.append("  <body>\n");
    s.append("    <h1>This is some content!</h1>\n");
    s.append("  </body>\n");
    s.append("</html>");

    String content = s.toString();

    s.setLength(0);
    s.append("HTTP/1.1 200 OK\r\n");
    s.append("Date: Fri, 31 Dec 1999 23:59:59 GMT\r\n");
    s.append("Content-Type: text/html; charset=utf-8\r\n");
    s.append("\r\n");
    s.append(content);
    s.insert(0, "http://www.example.com/path/file.php?param=123,456%20789 123.123.123.123 20120235131415 text/html "+(s.length()-3)+"\n");

    return new ByteArrayInputStream(s.toString().getBytes("UTF-8"));
  }   
View Full Code Here

Examples of java.lang.StringBuilder

    assertNotNull(r.getHttpResponse().getEntity());

    byte[] buffer = new byte[1000];
    r.getHttpResponse().getEntity().getContent().read(buffer, 0, 1000);

    StringBuilder s = new StringBuilder();
    s.append("<html>\n");
    s.append("  <head>\n");
    s.append("    <title>This is a web page!</title>\n");
    s.append("  </head>\n");
    s.append("  <body>\n");
    s.append("    <h1>This is some content!</h1>\n");
    s.append("  </body>\n");
    s.append("</html>");

    String v1 = s.toString();
    String v2 = new String(buffer, "UTF-8");

    assertEquals(v1.trim(), v2.trim());
  }
View Full Code Here

Examples of java.lang.StringBuilder

    public abstract String name();

    @Override
    public String toString() {
        StringBuilder msg = new StringBuilder();

        msg.append("(Name: " + name() + " Operator Key: " + mKey + ")");

        return msg.toString();
    }
View Full Code Here

Examples of java.lang.StringBuilder

        this.totalSplits = totalSplits;
    }

    @Override
    public String toString() {
        StringBuilder st = new StringBuilder();
        st.append("Number of splits :" + wrappedSplits.length+"\n");
        try {
            st.append("Total Length = "+ getLength()+"\n");
            for (int i = 0; i < wrappedSplits.length; i++) {
                st.append("Input split["+i+"]:\n   Length = "+ wrappedSplits[i].getLength()+"\n  Locations:\n");
                for (String location :  wrappedSplits[i].getLocations())
                    st.append("    "+location+"\n");
                st.append("\n-----------------------\n");
          }
        } catch (IOException e) {
          return null;
        } catch (InterruptedException e) {
          return null;
        }
        return st.toString();
    }
View Full Code Here

Examples of java.lang.StringBuilder

     * @param delim Delimiter to use in the string.
     * @return A string containing the tuple.
     * @throws ExecException if a non-atomic value is found.
     */
    public String toDelimitedString(String delim) throws ExecException {
        StringBuilder buf = new StringBuilder();
        for (Iterator<Object> it = mFields.iterator(); it.hasNext();) {
            Object field = it.next();
            buf.append(field == null ? "" : field.toString());
            if (it.hasNext())
                buf.append(delim);
        }
        return buf.toString();
    }
View Full Code Here

Examples of java.lang.StringBuilder

           throw new ParseException(err.getMessage());
          }     
        }
        catch (Exception e) {
          LOG.error("Parsing exception:"+e.toString());
          StringBuilder buffer = new StringBuilder(16000); // TODO MC
          Token t=null
         
          do {
            try {
              t = getNextToken();
              buffer.append(t.image);
            }                       
            catch (Error err) {
              LOG.error("Parsing nested error:"+err.toString());
            }
            catch (Exception enest) {
              LOG.error("Parsing nested exception:"+enest.toString());
            }
          }
          while (t.kind != DOC_END && t.kind != EOF);
          docBody.append(buffer.toString()); // TODO MC
          if (t.kind != EOF) {
            // Eat up DOC_END.
            try {
              t = getNextToken();
            }             
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.