/*
Copyright 2015 Google Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package com.google.security.zynamics.zylib.strings;

/**
 * Small helper class for String related helper functions.
 */
public class StringHelper {
  /**
   * Counts how often a character appears in a given string.
   *
   * @param string The string to search through.
   * @param c The character to search for.
   *
   * @return Number of times the character appears in the string.
   */
  public static int count(final String string, final char c) {
    int counter = 0;

    for (int i = 0; i < string.length(); i++) {
      if (string.charAt(i) == c) {
        counter++;
      }
    }

    return counter;
  }

  /**
   * Replaces all occurrences of a substring inside a string.
   *
   * @param inputLine The input string.
   * @param source The substring to be replaced.
   * @param target The replacement of the substring.
   *
   * @return The input line with all occurrences of source replaced by target.
   */
  public static String replaceAll(final String inputLine, final String source, final String target) {
    int index = inputLine.indexOf(source);

    String ret = inputLine;

    while (index != -1) {
      ret = ret.substring(0, index) + target + ret.substring(index + source.length());
      index = ret.indexOf(source);
    }

    return ret;
  }
}

@@ -1032,173 +1032,454 @@
     
-int counter = 0;%0A%0A    for (int i = 0; i %3C string.length(); i++) %7B%0A      if (string.charAt(i) == c) %7B%0A        counter++;%0A      %7D%0A    %7D%0A%0A    return counter;%0A  %7D%0A%0A  /**
+return (int) string.chars()%0A                  .filter(character -%3E character == c)%0A                  .count();%0A  %7D%0A%0A  /**%0A   * Deprecated. Use replaceAll(String regex, String replacement) method%0A   * of the java.lang.String class instead;%0A   * %0A   * For example:%0A   * %7B@code%0A   * String initialString = %22I teed some tews%22;%0A   * String resultString = initialString.replaceAll(%22t%22, %22n%22);%0A   * //resultString will be: %22I need some news%22%0A   * %7D%0A   * 
 %0A   
@@ -1766,32 +1766,46 @@
 y target.%0A   */%0A
+  @Deprecated%0A
   public static 

Update StringHelper.java