I wold like some help of converting an input (word or number or mix) into a single row vector, such as the following:

If input is ">DAVID123<" I want it to be as {>,D,A,V,I,D,1,2,3,<}

where all letters considered as unknown variables.


1 Answer 1



ToExpression[Select[Characters[">DAVID123<" ],StringMatchQ[#,LetterCharacter]&]]

which will give you a vector of


as symbols or variables, but C and D and E and I and K have predefined meaning inside of Mathematica and may cause you grief.

  • $\begingroup$ what about the < and > can I convert them into 0 ? Also where are the numbers {1,2,3} ? $\endgroup$
    – Love Eva
    Sep 17, 2019 at 6:39
  • $\begingroup$ This ToExpression[Characters[StringReplace[">DAVID123<",PunctuationCharacter:>"0"]]] gives you `{0,D,A,V,I,D,1,2,3,0} $\endgroup$
    – Bill
    Sep 17, 2019 at 8:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.