HP Pascal/iX Reference Manual (31502-90022)
Table Of Contents
- Top of Document
- Preface
- Chapter 1 Introduction
- Chapter 2 Language Elements
- Chapter 3 Data Types
- Chapter 4 Expressions
- Chapter 5 The Declaration Section
- Chapter 6 Statements
- Chapter 7 Program Structure
- Chapter 8 Procedures and Functions
- Chapter 9 Standard Routines
- Chapter 10 Input and Output
- Chapter 11 System Programming Extensions
- Chapter 12 Compiler Options
9- 11
str
Usage
str
(s, p, e)
Arguments
s
A string expression.
p
An integer expression indicating the index of the starting
character.
e
An integer expression indicating the length of the substring.
Description
The function str
(s, p, e)
returns the portion of
s
which starts at
s [ p
]
and is of length
e
. The result is type string, and may be used as a
string expression. It is an error if strlen
(s)
is less than
p
+ (
e
-1).
Example
VAR
i: integer;
wish_list: string[132];
granted: string[5];
BEGIN
.
i:= 13;
wish_list:= 'wish1 wish2 wish3 wish4 wish5';
granted:= str(wish_list,i,5); { Selects the 3rd wish. }
{ Granted is 'wish3'. }
END.
strlen
Usage
strlen
(s)
Argument
s
A string expression.
Description
The function strlen
(s)
returns the current length of the string or PAC
expression
s
. If
s
is not initialized, strlen
(s)
is undefined.
Example
VAR
ars, vita: string[132];
b: boolean;
BEGIN
.
ars:= 'HELLO';
vita:= 'TO YOU';
IF strlen(ars) > strlen(vita) THEN
b:= true
ELSE
b:=false;
.