Пример #1
0
 public void testReplace6() {
   // compare is currently ignored
   assertEquals("azaz", Vba.replace("xyzxyz", "xy", "a", 1, -1, 1000));
   assertEquals("azxyz", Vba.replace("xyzxyz", "xy", "a", 1, 1, 0));
   assertEquals("azaz", Vba.replace("xyzxyz", "xy", "a", 1, 2, -6));
   assertEquals("xyzazxyz", Vba.replace("xyzxyzxyz", "xy", "a", 2, 1, 11));
 }
Пример #2
0
 public void testReplace4() {
   assertEquals("azaz", Vba.replace("xyzxyz", "xy", "a", 1));
   assertEquals("xyzaz", Vba.replace("xyzxyz", "xy", "a", 2));
   assertEquals("xyzxyz", Vba.replace("xyzxyz", "xy", "a", 30));
   // spec doesn't say, but assume starting before start of string is ok
   assertEquals("azaz", Vba.replace("xyzxyz", "xy", "a", 0));
   assertEquals("azaz", Vba.replace("xyzxyz", "xy", "a", -5));
 }
Пример #3
0
 public void testReplace3() {
   // replace with longer string
   assertEquals("abczabcz", Vba.replace("xyzxyz", "xy", "abc"));
   // replace with shorter string
   assertEquals("wazwaz", Vba.replace("wxyzwxyz", "xy", "a"));
   // replace with string which contains seek
   assertEquals("wxyz", Vba.replace("xyz", "xy", "wxy"));
   // replace with string which combines with following char to make seek
   assertEquals("wxyzwx", Vba.replace("xyyzxy", "xy", "wx"));
   // replace with empty string
   assertEquals("wxyza", Vba.replace("wxxyyzxya", "xy", ""));
 }
Пример #4
0
 public void testReplace5() {
   assertEquals("azaz", Vba.replace("xyzxyz", "xy", "a", 1, -1));
   assertEquals("azxyz", Vba.replace("xyzxyz", "xy", "a", 1, 1));
   assertEquals("azaz", Vba.replace("xyzxyz", "xy", "a", 1, 2));
   assertEquals("xyzazxyz", Vba.replace("xyzxyzxyz", "xy", "a", 2, 1));
 }