4
$\begingroup$

I have this code:

text = "Today I woked up early"
cadena = InputForm[StringSplit[text]]
out:{"Today", "I", "woked", "up", "early"}

Why don't work this?

"\"#\"" & /@ {Monday, Tuesday, Wednesday, Thursday, Friday}
out:{"#", "#", "#", "#","#"}

The pure function only work with numbers?

$\endgroup$

closed as off-topic by Alexey Popkov, MarcoB, Coolwater, Henrik Schumacher, m_goldberg May 19 '18 at 13:47

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Alexey Popkov, MarcoB, Coolwater, Henrik Schumacher, m_goldberg
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    $\begingroup$ You probably want either "\"" <> ToString[#] <> "\"" & /@ {Monday, Tuesday, Wednesday, Thursday, Friday} or ToString[#] & /@ {Monday, Tuesday, Wednesday, Thursday, Friday}. $\endgroup$ – Henrik Schumacher May 18 '18 at 22:42
  • $\begingroup$ Yes I may sound as a grammar nazi, but heck I could't resist it. Today I woke up early is more accurate :p $\endgroup$ – polfosol May 19 '18 at 9:04
10
$\begingroup$

Outside of quotes, # is shorthand for Slot[], but in quotes it's only a character. So, don't quote it:

"\"" <> SymbolName[#] <> "\"" & /@ {Monday, Tuesday, Wednesday,Thursday, Friday}
(* {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday"} *)
$\endgroup$

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