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- 12
writeln (strlen(ars):2,strlen(vita):2);
END.
Output:
5 6
strltrim
Usage
strltrim
(s)
Argument
s
A string expression.
Description
The function strltrim
(s)
returns a string consisting of
s
trimmed of all
leading blanks. The function strrtrim trims trailing blanks.
Example
VAR
s: string[80];
BEGIN
.
s:= ' abc';
s:=strltrim(s); {s is now 'abc'}
. {strlen(s) = 3 }
END.
strmax
Usage
strmax
(s)
Argument
s
A string variable.
Description
The function strmax
(s)
returns the maximum length of
s
. Strmax is useful
for finding the maximum length of VAR string parameters whose maximum is
not determined until run time.
Example
VAR
s: string[15];
BEGIN
s:= ' ABCDE ';
IF strlen(s) = strmax(s) THEN
BEGIN
s:= strltrim(s);
s:= strrtrim(s);
END;
writeln (s,strmax(s):3);
.
END.
Output: