Aer Interpreter Source
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.
 
 

35 lines
679 B

class StringTokenizer {
private string $token;
private string $delim;
public void __construct(string $str, string $delim = ' ') {
$this->token = strtok($str, $delim);
$this->delim = $delim;
}
public void __destruct() {
}
public bool hasMoreTokens() {
return ($this->token != NULL);
}
public string nextToken() {
string $current = $this->token;
$this->token = strtok($this->delim);
return $current;
}
}
class Program {
public void main() {
string $str = "This is:@\t\n a TEST!";
string $delim = " !@:\t\n";
object $st = new StringTokenizer($str, $delim);
while ($st->hasMoreTokens()) {
print($st->nextToken(), "\n");
}
unset($st);
}
}