Package java.lang

Examples of java.lang.StringBuilder.indexOf()


    startTime = System.currentTimeMillis();
    String commentStart = "<wp:comment>";
    int commentStartLength = commentStart.length();
    String commentEnd = "</wp:comment>";
    int commentEndLength = commentEnd.length();
    int startIndex = blogXML.indexOf(commentStart);
    int endIndex;
    int count = 0;
    while (startIndex > -1) {
      endIndex = blogXML.indexOf(commentEnd, startIndex
          + commentStartLength);
View Full Code Here


    int commentEndLength = commentEnd.length();
    int startIndex = blogXML.indexOf(commentStart);
    int endIndex;
    int count = 0;
    while (startIndex > -1) {
      endIndex = blogXML.indexOf(commentEnd, startIndex
          + commentStartLength);
      blogXML = blogXML.delete(startIndex, endIndex + commentEndLength);
      count++;
      if (count % 1000 == 0) {
        System.out.println(count
View Full Code Here

            + " occurrences are found and removed. Average speed: "
            + count
            / ((System.currentTimeMillis() - startTime) / 1000.)
            + " occurrences per second.");
      }
      startIndex = blogXML.indexOf(commentStart, startIndex);
    }
    System.out.println(count + " occurrences are found and removed.");
    endTime = System.currentTimeMillis();
    timeUsed = (endTime - startTime) / 1000.;
    System.out.println("The time used for replacement is: " + timeUsed
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.