Einzelnen Beitrag anzeigen
Alt 25.05.2007, 15:17   #2
waldbauer.com
Entwickler
Beschreibung vorhanden OSA CONVERT

E r g e b n i s / R e s u l t

Wandelt eine Zeichenkette in eine Anzahl von Satzfunktionen um
Convert a string in a number of set functions

B e s c h r e i b u n g / D e s c r i p t i o n

The CONVERT function can perform many transformations on a string. These include removing spaces, case conversion and deleting characters. One of the most important options available to the user is the ability to ignore strings enclosed in quotes. So it is possible to request an entire string is converted to uppercase, except for those words in quotes. Two other possible uses of the function are to remove all spaces from a string. This may be useful if you prompt a user for a filename. Another use might be the removal of all but numeric characters. Multiple options can be passed to the routine. Some will turn others off and take precedence over others. (If you would like to suggest other conversion routines to be added to CONVERT, please contact us and let us know your ideas.)

S y n t a x
Code:
answer = call('CONVERT' , string , options)
P a r a m e t e r
string - an Open Access string
options - a string containing multiple options controlling the
transformation of the input string. The options are :-
A - characters enclosed in quotes are not converted.
B - Remove ALL spaces.
C - Remove leading spaces.
D - Remove trailing spaces.
E - Convert all double spaces to just 1 space.
F - Convert to uppercase.
G - Convert to lowercase.
H - Convert to proper ie. capitalise the first letter of each
word and make the rest of the word lowercase.
I - Convert spaces to character 255.
J - Convert all characters < ASCII 32 to spaces.
K - Remove all characters < ASCII 32.
L - Remove all non-numeric characters.

R e t u r n s
A string is returned.

B e i s p i e l / E x a m p l e

Code:
attach 'CONVERT'
a = 'file: myfile. txt' ! test string
option = 'bf' ! Remove all spaces and convert
! to uppercase
put call('CONVERT' , a , option) ! Prints 'FILE:MYFILE.TXT'
a = 'The number is 123' ! test string
option = 'l' ! Remove all non-numeric characters
put call('CONVERT' , a , option) ! Prints '123'
detach 'CONVERT'
Q u e r v e r w e i s / R e f e r e n c e
CVTNUM
Angehängte Dateien
Dateityp: oac convert.oac‎ (17.0 KB, 5x aufgerufen)
Dateityp: txt CONVERT.TXT‎ (5.7 KB, 2x aufgerufen)
waldbauer.com ist offline   Mit Zitat antworten