lib-strings
A collection of string-handling routines (Shameless cut-n-paste from the library itself here). This library should be the third program installed on a new muck, (cmd-register and lib-glow-standard come first).
| STRblank? | [ str -- bool ] | true if str is null or only spaces |
| STRsls | [ str -- str' ] | strip leading spaces |
| STRsts | [ str -- str' ] | strip trailing spaces |
| STRstrip | [ str -- str' ] | strip lead and trail spaces |
| STRsms | [ str -- str' ] | strips out mult. internal spaces |
| STRsplit | [ str delim -- prestr postr ] | splits str on first delim. |
| STRrsplit | [ str delim -- prestr postr ] | splits str on last delim. |
| STRsplitargs | [ str -- str str ] | split a string at first space or = sign |
| STRfillfield | [ str char width -- padstr ] | return padding string to width chars. (I think this one is miss-named, since it doesn't actually pad the field, you have add a final strcat to do that, although it does allow you to control easily where the padding goes: strcat for the end, swap strcat for the beginning. |
| STRcenter | [ str width -- str' ] | center a string in a field. |
| STRleft | [ str width -- str' ] | pad string w/ spaces to width chars |
| STRright | [ str width -- str' ] | right justify string to width chars |
| STRasc | [ char -- i ] | convert character to ASCII number |
| STRchr | [ i -- char ] | convert number to character |
| STRparse | [ str -- str1 str2 str3 ] | This routine is useful for parsing command line input: " #X Y y = Z" -> "X" "Y y" " Z" |
feaelin@kemenel.org
lib-strings / Revised 2004 March 31 22:06 (Wednesday)
© 2004 Iain E. Davis
|