07.05.2015 Views

Download the PDF documentation - True BASIC

Download the PDF documentation - True BASIC

Download the PDF documentation - True BASIC

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

String Handling Libraries 4<br />

CHARINT$ Function<br />

Library:<br />

Syntax:<br />

Usage:<br />

Summary:<br />

Details:<br />

Example:<br />

Exceptions:<br />

See also:<br />

CHARS$ Function<br />

Library:<br />

Syntax:<br />

Usage:<br />

Summary:<br />

Details:<br />

Example:<br />

Exceptions:<br />

See also:<br />

STRLIB.TRC<br />

CHARINT$ (strex, strex)<br />

LET intersection$ = CHARINT$ (a$, b$)<br />

Returns <strong>the</strong> set of characters contained within <strong>the</strong> values of both a$ and b$.<br />

The CHARINT$ function returns a string containing <strong>the</strong> intersection of <strong>the</strong> sets of<br />

characters represented by <strong>the</strong> values of its arguments a$ and b$.<br />

That is, <strong>the</strong> CHARINT$ function returns a string which contains one of each character<br />

which appears in <strong>the</strong> values of both its arguments. The characters will be organized within<br />

<strong>the</strong> resulting string in ascending order by <strong>the</strong>ir ASCII codes. Thus, uppercase letters will be<br />

listed before all lowercase letters.<br />

The following program:<br />

LIBRARY "StrLib.trc"<br />

DECLARE DEF CharInt$<br />

LET a$ = "Hello, out <strong>the</strong>re"<br />

LET b$ = "aeiouy"<br />

PRINT "*"; CharInt$ (a$, b$); "*"<br />

END<br />

produces <strong>the</strong> following output:<br />

*eou*<br />

None<br />

CHARUNION$, CHARDIFF$, CHARS$, UNIQ$<br />

STRLIB.TRC<br />

CHARS$ (numex, numex)<br />

LET set$ = CHARS$ (start, end)<br />

Returns <strong>the</strong> set of characters whose ASCII codes range from <strong>the</strong> value of start to <strong>the</strong> value<br />

of end.<br />

The CHARS$ function returns a string containing <strong>the</strong> set of characters whose ASCII codes<br />

range in value from start to end.<br />

If <strong>the</strong> value of start is less than or equal to <strong>the</strong> value of end, <strong>the</strong>n <strong>the</strong> characters within<br />

<strong>the</strong> resulting string will be arranged in ascending order by ASCII codes. If <strong>the</strong> value of<br />

start is greater than <strong>the</strong> value of end, <strong>the</strong> resulting string will be arranged in descending<br />

order.<br />

If ei<strong>the</strong>r start or end has a value less than 0, a value of 0 will be used instead. Likewise, if<br />

ei<strong>the</strong>r has a value greater than 255, a value of 255 will be used instead.<br />

The following program:<br />

LIBRARY "StrLib.trc"<br />

DECLARE DEF Chars$<br />

PRINT Chars$ (33, 47)<br />

END<br />

produces <strong>the</strong> following output:<br />

!"#$%&'()*+,-./<br />

None<br />

CHARINT$, CHARDIFF$, CHARUNION$, UNIQ$

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

Saved successfully!

Ooh no, something went wrong!