STRING$

Contents


String$ is used to define a string, the result of repeating a sub-string or an ascii code

 

Syntax

string$(nb_char, sub_string)
string$(nb_char, code_char)

 

Parameters

Element

Description

Restrictions

nb_char

Integer numerical expression of the repeat factor of the characters or sub_string

nb_char   >=  0

sub_string

Alphanumeric expression that will be repeated

None

code_char

Integer numerical expression corresponding to the ascii code of the character to be repeated.

0 <= code_char <=255

 

Examples

   # 5 'A' characters may be displayed by one of the 2 lines:
    Infbox string$(5, 'A')
    Infbox string$(5, 65)

 

Description and comments

string$(nb_char, code_char) returns a string comprising nb_char characters with ascii code code_char.

string$(nb_char, sub_string) returns a string comprising the repeat of the sub_string nb_char times.

The result is a Char type.

 

Comments

If the number of characters in the result is more than 255, the string returned is truncated to 255 characters without generating an error.

If nb_char is null or if code_char is null or if sub_string is the empty string, the result returned by string$ is the empty string.

 

Associated errors

Error

Description

ERDOM (50)

- code_chr is negative or more than 255.
- nb_char is negative.

ERMODE (10)

nb_char is not numerical.

 

Associated key words

SPACE$ - ASCII - CHR$ - GRAPH$


CONTENTS


Copyright © Sage 1999 - 2007