CleanString$()

Syntax

CleanString$(Source$)

Remarks

Removes nonprinting characters and special Word characters from Source$, or changes them to spaces (character code 32).

In Windows and on the Macintosh, the following characters are changed to spaces, unless otherwise noted.

Character code

Description

1–29

Nonprinting characters. Character 13 (paragraph mark) is not removed. Character 10 is converted to character 13, unless preceded by character 13, in which case character 10 is removed. Character 7 is removed, unless preceded by character 13, in which case character 7 is converted to character 9 (tab character).

31

Optional hyphen. Character 31 is removed rather than changed to a space.


In Windows, the following characters are converted as described.

Character code

Description

160

Nonbreaking space; changed to a space

172

Optional hyphen symbol; removed

176

Nonbreaking space symbol; changed to a space

182

Paragraph mark character; removed

183

Bullet character; changed to a space


On the Macintosh, the following characters converted as described.

Character code

Description

194

Optional hyphen symbol; removed

202

Nonbreaking space; changed to a space


If a field is included in the selection and the field codes are displayed, CleanString$() changes the field characters to spaces.

Example

This example uses CleanString$() to remove any nonprinting characters (except character 13) in the selected text:


temp$ = Selection$()
clean$ = CleanString$(temp$)

See Also

LTrim$(), RTrim$()