11.04.2013 Views

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Parameter Description<br />

A Specifies that only alphabetic characters match the pattern.<br />

N Specifies that only numbers match the pattern.<br />

text Specifies a literal string to search for. Enclose this literal text within single<br />

quotation marks if combined with a pattern (made up of X, A, and N).<br />

Examples<br />

MATCH Parameters (continued)<br />

In the following example, the program segment determines if the variable SSN is a<br />

valid social security number:<br />

SSN = "522-13-5124"<br />

SSNTEST = SSN MATCH "3N'-'2N'-'4N"<br />

The following program accepts as input a pattern to match and a string to search:<br />

PRINT "This program tests the MATCH function"<br />

PRINT "Enter pattern ":<br />

INPUT pattern<br />

PRINT "Enter string to match":<br />

INPUT string1<br />

answer = string1 MATCH pattern<br />

PRINT \"\ : answer : \"\<br />

In the following test executions of the preceding program, the user tests for a string<br />

that consists of three alphabetic characters followed by the literal “3A”. The literal<br />

(3A) is enclosed in quotation marks to differentiate it from the pattern 3A.<br />

:RUN BP match.test<br />

This program tests the MATCH function<br />

Enter pattern ?3A'3A'<br />

Enter string to match?AAA3A<br />

"1"<br />

:RUN BP match.test<br />

This program tests the MATCH function<br />

Enter pattern ?3A'3A'<br />

Enter string to match?3AAAA<br />

"0"<br />

MATCH 1-443

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!