Camel case and snake case: Difference between revisions

Content added Content deleted
Line 177: Line 177:
<lang factor>USING: formatting kernel math regexp sequences splitting
<lang factor>USING: formatting kernel math regexp sequences splitting
splitting.extras unicode ;
splitting.extras unicode ;
IN: rosetta-code.camel-snake


! ignore leading/trailing whitespace; don't trim it
! ignore leading/trailing whitespace
: preserve ( str quot -- newstr )
: preserve ( str quot -- newstr )
[ [ blank? ] split-head [ blank? ] split-tail swap ] dip
[ [ blank? ] split-head [ blank? ] split-tail swap ] dip