You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.8 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. // * NEIU CS207-2 Fall 2018
  2. // * Homework 4 TestMiniString.java
  3. // * This is the class with a main(), to test MiniString
  4. public class TestStringPractice
  5. {
  6. public static void main(String[] args)
  7. {
  8. MiniString s1 = new MiniString("Hello world, welcome to the Java world.");
  9. System.out.println(s1.makeSubstring(0));
  10. System.out.println(s1.makeSubstring(6));
  11. System.out.println(s1.makeSubstring(6, 14));
  12. System.out.println(s1.makeSubstring(13));
  13. System.out.println(s1.makeSubstring(0, 12));
  14. System.out.println();
  15. System.out.println(s1.findIndexOf('w'));
  16. System.out.println(s1.findIndexOf('m'));
  17. System.out.println(s1.findIndexOf('x'));
  18. System.out.println(s1.findIndexOf('J'));
  19. System.out.println(s1.findIndexOf('a'));
  20. System.out.println();
  21. System.out.println(s1.findIndexOf('w', 7));
  22. System.out.println(s1.findIndexOf('m', 20));
  23. System.out.println(s1.findIndexOf('x', 10));
  24. System.out.println(s1.findIndexOf('J', 30));
  25. System.out.println(s1.findIndexOf('a', 30));
  26. System.out.println();
  27. System.out.println(s1.findIndexOf("wo"));
  28. System.out.println(s1.findIndexOf("we"));
  29. System.out.println(s1.findIndexOf("He"));
  30. System.out.println(s1.findIndexOf("Ja"));
  31. System.out.println(s1.findIndexOf("va"));
  32. System.out.println();
  33. System.out.println(s1.findIndexOf("wo", 7));
  34. System.out.println(s1.findIndexOf("we", 20));
  35. System.out.println(s1.findIndexOf("He", 10));
  36. System.out.println(s1.findIndexOf("Ja", 30));
  37. System.out.println(s1.findIndexOf("va", 25));
  38. System.out.println();
  39. } // End main()
  40. } // End class TestMiniString