[Omake] splitting a string

David Kågedal davidk at lysator.liu.se
Wed Sep 13 00:46:52 PDT 2006


I'm trying to convert some shell scripts in my old Make rules to
omake.  One thing I need to do is to split a string into a sequence of
characters, or a sequence of 1-char strings if that makes more sense.

The old code does

    x="`echo $$str | sed "s/./\'&\',/g"`" 

which will convert

    foo bar

into

    'f','o','o',' ','b','a','r',

I tried the obvious S = $(S.map $(fun x, $x\,)), but that doesn't
iterate over the characters.  The split function can't be used
either.  So how would I go about to get at the individual characters
of a string?

-- 
David Kågedal



More information about the Omake mailing list