Quite new to java what do you think of mine?
import java.util.*;
public class RemoveDuplicates {
public static void main(String[] args){
while(true) {
System.out.println("Enter String");
Scanner input = new Scanner(System.in);
String str = input.nextLine();
System.out.println(RemoveDup(str));
}
}
public static String RemoveDup(String str){
str = str.toLowerCase();
String temp = "";
for (int i=0; i<str.length(); i++){
if (!temp.contains(Character.toString(str.charAt(i)))){
temp+=str.charAt(i);
}
}
return temp;
}
}
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/vD7vwu7Fz_oJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.