If it matches, the scan pointer is advanced to the end of the match, and the
length of the match is returned. Otherwise, +null+ is returned.
It's similar to #scan, but without returning the matched string.
public function testSkipAndSkipUntil() { $s = new StringScanner('test string'); $this->assertEquals(4, $s->skip('/\\w+/')); $this->assertNull($s->skip('/\\w+/')); $this->assertEquals(1, $s->skip('/\\s+/')); $this->assertEquals(6, $s->skip('/\\w+/')); $this->assertNull($s->skip('/./')); $s = new StringScanner("Fri Dec 12 1975 14:39"); $this->assertEquals(10, $s->skipUntil('/12/')); }
function testSkip() { $sc = new StringScanner("foobar blorg bla"); $res = $sc->skip("hihi"); $this->assertEqual($res, null); $this->assertEqual($sc->rest(), "foobar blorg bla"); $res = $sc->skip("\\w+\\s+"); $this->assertEqual($res, 7); $this->assertEqual($sc->rest(), "blorg bla"); }