Split and Replace
Given three strings
inputString, separator and replaceString as inputs. Write a JS program to split the
inputString with the given separator and replace strings in the resultant array with the replaceString whose length is greater than 7.
Quick Tip
Sample Input 1
JavaScript-is-amazing
-
Programming
Sample Output 1
Programming is amazing
Pattern pattern = Pattern.compile("([0-9]+)|(\\+|\\-|\\*|\\/)");
Matcher matcher = pattern.matcher("15+25*10/2");
while (matcher.find()) {
System.out.println(matcher.group());
}
Comments
Leave a comment