Please enable JavaScript to view this site.

A-Shell Reference

xcall XSTRIP, strarg

xcall XSTRIP, strarg, filter, opcode

XSTRIP performs various string editing operations. Note that in the first syntax, the routine is equivalent to XCALL STRIP (removes trailing blanks).

Parameters

strarg  (String, 2+ bytes)  [in/out]

the string to be operated on.

filter  (String, 1+ bytes)  [in]

contains filter info, depending on opcode.

opcode  (Num)  [in]

defines the operation.

Opcode

Function

1

All occurrences of any of the individual characters in the filter are removed from strarg.

2

All occurrences of characters NOT in filter are removed from strarg.

3

Remove Words. filter contains a comma-separated list of words to be removed from strarg. Double spaces resulting from the removal of a word are shortened to a single space. Example:

strarg = "THIS IS A TEST OF THIS XCALL ROUTINE"

filter = "THIS,TEST,ROUTINE"

XCALL XSTRIP,strarg,filter,3

Result: strarg = " IS A OF XCALL "

4

Removes matching characters from start of string. For example:

strarg = "THIS IS A TEST TO SEE WHAT IS HAPPENING."

filter = "SIHT "

XCALL XSTRIP,strarg,filter,4

Result: strarg = "A TEST TO SEE WHAT IS HAPPENING."

Note: The removal process was terminated at the first character of strarg for which there was no match in filter ("A").

5

Remove matching characters from the end of the string. Same concept as opcode 4 but starts at the end of strarg and works backwards.

6

Pair-wise character substitution: filter must contain an even number of characters, interpreted as pairs. Each occurrence in strarg of the first character in each pair (of filter) is replaced with the second character of the pair. Example:

XCALL XSTRIP,strarg,"A1B2",6   ! replace all "A" with "1"; "B" with "2"

7

Reduce multiple spaces to single spaces. filter not used. E.g.: XCALL XSTRIP,strarg,"",7

8

(not used)

9

Combines the action of opcodes 4 (strip leading characters) and 5 (strip trailing characters) to make it a simpler alternative to Xcall TRIM when you want to strip something other than space as TABs.

 

History

2024 August, A-Shell 7.0.1762: added opcode 9.

2011 May, A-Shell 5.1.1215: XSTRIP added to the standard release, after fixing some bugs introduced in 5.1 during translation of the original proprietary version written by John Pruitt.