Camel case and snake case: Difference between revisions
→{{header|Factor}}: simplify
m (→{{header|Factor}}: probably a good idea) |
(→{{header|Factor}}: simplify) |
||
Line 177:
<lang factor>USING: formatting kernel math regexp sequences splitting
splitting.extras unicode ;
IN: rosetta-code.camel-snake
! ignore leading/trailing whitespace; don't trim it
: preserve ( str quot -- newstr )
[ [ blank? ] split-head [ blank? ] split-tail swap ] dip
Line 194 ⟶ 195:
: >camel ( str -- newstr )
[
"\s_-" split harvest 1 short cut
] preserve ;
|