< Back to IRCAM Forum

OM-Sharp string->ascii

Hi, I’m porting my DK-Tool Box to OM-Sharp, and so far it has went well, since I do not use non compatible libraries. But the string->ascii is dead.

Best

Dagfinn

Hi Dagfinn.

Not too sure about #'string->ascii, where did you find that one?

But a workaround, if you want to get the individual characters in a string, could be (coerce “string” 'list).

If you need the ascii-code for each character, try #'char-code on each one

-anders

Hi Dagfinn,

I don’t know how this will work out on omsharp, but here is the code:

(defmethod! string->ascii ((text t))
:icon 157
:indoc '(“text”)
:initvals '(nil)
:doc “Returns the ascii code of the text-string .”

(let ((format-text (if (listp text) (first text) text)))
(if (stringp format-text)
(let ((char-text (coerce format-text ‘list)))
(mapcar #’(lambda (x) (char-code (character x))) char-text))
(format nil “this is not a string”))))

Maybe you can try to find some workaround…

Best luck
K

Hi Anders, I got it from Karim way back.
Thanks for the tip about #'char-code. I’ll have to find out how I do it. I like challenges!

Best

Dagfinn

Hi Karim, thanks a lot! I’ll try to implement your code. A huge exciting challenge. But I prioritise OM 6.18. It is for me easy to get trapped in programming instead of composing. So it is about making priorities, which I’m not good at…

Best

Dagfinn