Update StringIterator.java

This commit is contained in:
Neetika23 2023-10-27 14:51:01 +05:30 committed by GitHub
parent 98c8e96fca
commit 66604b8e27
1 changed files with 0 additions and 17 deletions

View File

@ -4,14 +4,6 @@ import java.text.*;
import java.util.*;
public class StringIterator {
public static void main(String[] args) {
String str = "Hello, Baeldung!";
System.out.println(javaforLoop(str));
System.out.println(java8forEach(str));
System.out.println(javaCharArray(str));
System.out.println(javaRegexExp(str));
System.out.println(javaCharacterIterator(str));
}
public static String javaCharArray(String str){
StringBuilder result = new StringBuilder();
@ -38,15 +30,6 @@ public class StringIterator {
return result.toString();
}
public static String javaRegexExp(String str){
StringBuilder result = new StringBuilder();
String[] characters = str.split("");
for (String c : characters) {
result.append(c);
}
return result.toString();
}
public static String javaCharacterIterator(String str){
StringBuilder result = new StringBuilder();
CharacterIterator it = new StringCharacterIterator(str);