basic.convert

Statement/BASIC Program, Releases: AP

Converts characters.

Syntax

convert string.expression1 to string.expression2 in variable

Description

searches a given variable and replaces each occurrence of a character by another.
Any character designated in 'string.expression1' is replaced with the corresponding replacement character from 'string.expression2'. The correspondence is by column position in 'string.expression1' and 'string.expression2'.

If the length of 'string.expression1' is shorter than the length of 'string.expression2', all characters in 'string.expression2' beyond the length of 'string.expression1' are ignored.

If the length of 'string.expression1' is longer than the length of 'string.expression2', all characters in 'string.expression1' beyond the length of 'string.expression1' are deleted from 'variable'.

Example

convert char(254) to ' ' in text.string

All attribute marks are replaced with spaces in the variable
'text.string'.

equ am to char(254)
convert am to char(10) in text.item

This converts the attribute marks in 'text.item' to linefeed
characters.

x = 'abc'
convert 'abc' to 'd' in x ; crt x

This outputs 'd'.

x = 'd'
convert 'd' to 'abc' in x ; crt x

This outputs 'a'.

x = 'abba'
convert 'ab' to 'zm' in x ; crt x

This outputs 'zmmz'.

See Also

Command Name Type Description
variables Definition store a number, string, file descriptor, or select list, and may change dynamically throughout the execution of the program.
basic.string.expression Definition An expression which evaluates to a string.
basic.statements Definition Definition of statements and functions.
ue.009e User Exit Scans and replaces text.
basic.convertfn Function Converts characters.

User Comments

What do you think?

Share your experience or ask a question by using the form below.

Login to leave your comments.