Mitsubishi QD51 Programming Manual page 556

Logic controller
Hide thumbs Also See for QD51:
Table of Contents

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
STRING$
Function
• Returns the specified character for the specified number of times.
STRING$(<numeric expression 1>,<character string expression>)
Syntax
STRING$(<numeric expression 1>,<numeric expression 2>)
numeric expression 1
character string expression
numeric expression 2
A$=STRING$(5,"M")
Examples
B$=STRING$(3,&H41)
• The STRING$ function returns the specified character for the specified number of times.
Description
• Specify the number of characters in the string obtained in <numeric expression 1>.
• If <character string expression> is used to specify the character, only the first character in
the string is valid. If <numeric expression 2> is used to specify the character, it indicates
that the character code is to be repeated. The allowable specification range of the value is
from 0 to 255. If a value greater than 255 is specified, an "Illegal function call" error occurs.
• It is not allowed to specify a full-byte character in <character string expression> or
<numeric expression 2>. If it is specified, the operation cannot be performed normally.
Program Example
10 ' Display a number of "*" according to the value of the variable A
20 FOR I=0 TO 5
30 A=2^I
50 A$=STRING$(A,"*")
60 PRINT A$
70 NEXT I
80 END
RUN
*
**
****
********
****************
********************************
OK
11 - 386
STRING$
• • • •
Specify the number of characters to be returned.
• • • •
Specify the character to be returned.
• • • •
Specify the character code of the character to be
returned.
• • • •
Assigns five "M" characters to A$.
A$
M
• • • •
Assigns three characters of the character code $H41
(=A) to B$.
B$
A
:
' Repeats from I=0 to 5
:
' Calculates the value of A
:
' Assigns the number of "*" obtained in the
calculation
:
' Displays the result
M
M
M
M
A
A
MELSEC-Q
11 - 386

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents