Created
December 6, 2015 10:20
-
-
Save KristerV/58df0d86c3aa3fb60b0b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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