Skip to content

Instantly share code, notes, and snippets.

@KristerV
Created December 6, 2015 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KristerV/58df0d86c3aa3fb60b0b to your computer and use it in GitHub Desktop.
Save KristerV/58df0d86c3aa3fb60b0b to your computer and use it in GitHub Desktop.
public class Tryout {
public static void main(String[] args) {
String s = "Tere, TUDENG, 1234!";
String t = asenda(s); // "xxxx, xxxxxx, 1234!"
System.out.println(t);
}
public static String asenda(String s) {
String result = "";
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (Character.isLetter(c)) {
result += "x";
} else {
result += c;
}
}
return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment