18.10.2014 Views

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Programming</strong> <strong>Language</strong> Concepts<br />

ing characters in the string are used. Thus, substr.f(A,I,INF.C) refers to all remaining<br />

characters in the string starting from the I th position.<br />

2.21.3 Pattern Matching: MATCH.F(text, pattern, skip)<br />

The function match.f(A,B,I) searches from left to right for the character pattern defined by<br />

text variable B, within the text variable A, after skipping the first I characters of A. If the pattern<br />

is matched, the location of the pattern string within A is returned. If no matching string is found,<br />

zero is returned. Both A and B are unchanged. If either A or B is the null string, zero is returned.<br />

For example, if NAME is the string "JOHN JOHNSON":<br />

let I = match.f(NAME, "JOHN", 1)<br />

will return 6, as the first character position is skipped in the search.<br />

2.21.4 Length Function: LENGTH.F(text)<br />

A text variable may represent a character string of any length, from zero to a maximum of 32,000<br />

characters. The LENGTH.L function returns the length of the text variable or text expression given<br />

as an argument. The length of a null or unassigned string is zero.<br />

2.21.5 Case Conversion: UPPER.F(text) and LOWER.F(text)<br />

These functions convert the alphabetic characters of the given text argument to upper case or lower<br />

case, respectively. Other characters are not changed.<br />

2.21.6 String Repetition: REPEAT.F(string,count)<br />

This REPEAT.F function repeats string (a text variable) count times (where count is an integer),<br />

returning a text variable. For example:<br />

repeat.f ("CAMEL", 2)<br />

returns the string "CAMELCAMEL".<br />

2.21.7 Truncation and Expansion: FIXED.F(string,length)<br />

This FIXED.F function expands a text string to length, where length is an integer, by truncating<br />

or space-padding on the right. The new text string is returned. For example:<br />

fixed.f("CAMEL", 3)<br />

returns the string "CAM", while:<br />

fixed.f("DOG", 5)<br />

returns the string "DOG ".<br />

73

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

Saved successfully!

Ooh no, something went wrong!