Text Library
Text manipulation functions for ProTERM 1.2.
Current version is 1.0.3 (GESTALT(wik_text) == "010003").
Resident User Text is distributed with ProTERM, in the ":Macros:Contributed:Boo's Goodies:" folder.
Conversion Functions
- STR_PAD(STR text, STR char, INT width, INT type)
Pad a string with char (type: -1=left, 0=both ends, 1=right)
- STR_TRIM(STR text [, STR char] [, INT type])
Trim padding from a string (type: -1=left, 0=both ends, 1=right)
- UNPASCAL(STR text [, INT bytes])
Strips length prefix from pascal string (or WSTR or LSTR)
- PASCAL(STR text [, INT padto])
Add length prefix to string; optionally pad with nulls to fixed
length
- CRYP(STR text)
Simple encryption function to hide passwords from accidental
viewing or to "mark" data as not to be messed with :-)
- DECRYP(STR text)
Decodes text that was encrypted using CRYP()
- STRTRAN(STR within, STR find, STR repl)
Replace all occurrences of one string by another
- TXT_REVERSE(STR fwdtxt [, INT action])
Reverses order of characters in text
- PFX_EXPAND(STR text)
Expand control characters to caret prefix notation
- WORD_LIST([INT flags,] [STR word1 [, STR word2 [, ...]]])
Concatenates text args into a conversational series list, optionally
placing quotes around each text item. Mainly used for dialogs
Pseudo Floating Point (coming in v1.0.4)
- DEC_LEN(STR float [, INT preTrim])
Get length of decimal portion; optionally pre-trim trailing zeros
- DEC_SPLIT(STR float [, INT dec [, INT chopDP]])
Retrieve integer or decimal portion
- DEC_MOVEPT(STR float, INT places)
Move decimal point left (divide by ten) or right (multiply by ten)
- DEC_FIXPT(STR float, INT places)
Set decimal places (0..20)
- DEC_ROUND(STR float, INT places, INT how)
Round number (how: -1=down/trunc, 1=up)
Parsing Functions
- TAB_PARSE(STR line, INT index [, INT total])
Parses item from tab-delimited line. Maximum # of items per line is
27
- LINE_PARSE(STR list, INT index)
Parses line from return-delimited list. Maximum # of lines is 27
- IDX_DELIM(STR text, STR delim, INT index)
Parses item from delimited text
- PATTERNIZE(STR text)
Collapses characters in the range 0-9 to a "\d" pattern and
characters in the range A-Za-z to a "\s" pattern
Other Functions
- TXT_MATCH(STR find, STR within [, INT type])
Determines whether a string equals, starts with, contains,
or ends with another string. Useful with PATTERNIZE()
- OCCURS(STR find, STR within])
Returns number of occurrences of find-text in within-text
- FIND_NTH(STR find, STR within, INT nth)
Find nth occurrence in string
- GET_WSEL([INT win])
Get highlighted text from window
Obsolete Functions
- GET_HTXT(INT win)
Get highlighted text from specified window (DIRC code is useful)
(wik, April 18, 1997)
9023 visits since 97.04.18