Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. private String transformIWant(String statement)
  2. {
  3. // Remove the final period, if there is one
  4. statement = statement.trim();
  5. String lastChar = statement.substring(statement.length() - 1);
  6. if (lastChar.equals("."))
  7. {
  8. statement = statement.substring(0, statement.length() - 1);
  9. }
  10. int psn = findKeyword (statement, "I want", 0);
  11. String restOfStatement = statement.substring(psn + 6).trim();
  12. return "Would you really be happy if you had " + restOfStatement + "?";
  13. }
  14.  
  15. private String transformYouStatement(String statement)
  16. {
  17. // Remove the final period, if there is one
  18. statement = statement.trim();
  19. String lastChar = statement.substring(statement.length() - 1);
  20. if (lastChar.equals("."))
  21. {
  22. statement = statement.substring(0, statement.length() - 1);
  23. }
  24.  
  25. int psnOfYou = findKeyword (statement, "you", 0);
  26.  
  27. String restOfStatement = statement.substring(psnOfYou + 3);
  28. return "Why do you " + restOfStatement + " me?";
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement