String functions
Ralf Juengling <[email protected]> Tue, 22 Dec 2009 11:04:53 -0800 (PST)
| Newsgroups | gmane.lisp.lush.devel |
|---|---|
| Message-ID | <[email protected]> |
I have been working on revising the string functions
lately. Names like 'left', 'right', and 'index', have
been bugging me since I started using lush. Here is a
summary of the current state:
? ^Astr-
Search Results for: str-
1. (str-cat <s1> ... <sn>)
2. (str-mid <s> <n> [<l>])
3. (str-right <s> <n>)
4. (str-left <s> <n>)
5. (str-insert <s> <n> <s1>)
6. (str-subst <s> <s1> <s2>)
7. (str-del <s> <n> <l>)
8. (str-join <unsep> <ss>)
9. (str-split <s> <sep>)
10. (str-startswith <s> <prefix>)
11. (str-endswith <s> <suffix>)
12. (str-find <s> <r> [<n>])
13. (str-val <s>)
14. (str-strip <s>)
15. (str-stripl <s>)
16. (str-stripr <s>)
17. (declare (-str-) <var1>...<varN>)
choice>
There are also two new functions 'string-to-vector'
and 'vector-to-string', which do the obvious.
For string functions that take position arguments
(str-mid, str-del, str-insert), those are now zero-based
to bring string indexing in line with array indexing.
(Something to keep in mind when you port your code to
lush2).
You may also index strings directly,
? ("abcd" 0)
= 97
? ("abcd" 1)
= 98
?
and get the character code.
There is still no unicode support, however.
Ralf
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev