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.
59 lines
1.8 KiB
59 lines
1.8 KiB
|
|
// * NEIU CS207-2 Fall 2018
|
|
// * Homework 4 TestMiniString.java
|
|
// * This is the class with a main(), to test MiniString
|
|
|
|
public class TestStringPractice
|
|
{
|
|
public static void main(String[] args)
|
|
{
|
|
MiniString s1 = new MiniString("Hello world, welcome to the Java world.");
|
|
|
|
|
|
System.out.println(s1.makeSubstring(0));
|
|
System.out.println(s1.makeSubstring(6));
|
|
System.out.println(s1.makeSubstring(6, 14));
|
|
System.out.println(s1.makeSubstring(13));
|
|
System.out.println(s1.makeSubstring(0, 12));
|
|
System.out.println();
|
|
|
|
|
|
|
|
System.out.println(s1.findIndexOf('w'));
|
|
System.out.println(s1.findIndexOf('m'));
|
|
System.out.println(s1.findIndexOf('x'));
|
|
System.out.println(s1.findIndexOf('J'));
|
|
System.out.println(s1.findIndexOf('a'));
|
|
System.out.println();
|
|
|
|
|
|
|
|
System.out.println(s1.findIndexOf('w', 7));
|
|
System.out.println(s1.findIndexOf('m', 20));
|
|
System.out.println(s1.findIndexOf('x', 10));
|
|
System.out.println(s1.findIndexOf('J', 30));
|
|
System.out.println(s1.findIndexOf('a', 30));
|
|
System.out.println();
|
|
|
|
|
|
|
|
System.out.println(s1.findIndexOf("wo"));
|
|
System.out.println(s1.findIndexOf("we"));
|
|
System.out.println(s1.findIndexOf("He"));
|
|
System.out.println(s1.findIndexOf("Ja"));
|
|
System.out.println(s1.findIndexOf("va"));
|
|
System.out.println();
|
|
|
|
|
|
|
|
System.out.println(s1.findIndexOf("wo", 7));
|
|
System.out.println(s1.findIndexOf("we", 20));
|
|
System.out.println(s1.findIndexOf("He", 10));
|
|
System.out.println(s1.findIndexOf("Ja", 30));
|
|
System.out.println(s1.findIndexOf("va", 25));
|
|
System.out.println();
|
|
|
|
|
|
} // End main()
|
|
|
|
} // End class TestMiniString
|