SHARE
TWEET

Untitled

EvilShu Jun 19th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private static String findAnimalName(String string) {
  2.         return string.replaceAll("[^A-za-z]", "");
  3.     }
  4.  
  5.     private static String findAnimalType(String string) {
  6.         return string.replaceAll("[^A-za-z]", "");
  7.     }
  8.  
  9.     private static int findAnimalKilos(String string) {
  10.         int sum = 0;
  11.         String kilos = string.replaceAll("[^0-9]", "");
  12.         char[] kg = kilos.toCharArray();
  13.         System.out.println(Arrays.toString(kg));
  14.         for (char c :
  15.                 kg) {
  16.             int digit = c - '0';
  17.             sum += digit;
  18.         }
  19.         return sum;
  20.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top