Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.35 KB | None | 0 0
  1. public class Beautify {
  2.     public static void main(String[] args){
  3.         System.out.println(beaut("trots", 't'));
  4.     }
  5.     public static String beaut(String in, char b){
  6.         String result = "";
  7.         for(String s = in; s.length() > 0; s = s.substring(1)){
  8.             if(s.charAt(0) != b){
  9.                 result = result + Character.toString(s.charAt(0));
  10.             }
  11.         }
  12.         return result;
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement