Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Java StringBuilder filter same lines

Set<String> tokens = new HashSet<String>(Arrays.asList(s.split("
")));
StringBuilder resultBuilder = new StringBuilder();

boolean first = true;
for(String token : tokens) {
    if(first) first = false;
    else resultBuilder.append("
")

    resultBuilder.append(token);
}

String result = resultBuilder.toString();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Java #StringBuilder #filter #lines
ADD COMMENT
Topic
Name
6+9 =