Is there a way to Print a message suitable for Message? I want to recycle some messages (but Print them, so they don't get suppressed after X times and look like Print output).


Test::message="This is test number `1`.";

enter image description here

Desired functionality:

(* This is test number 1. *)

The inserting parts between back ticks is what really had me confused.


1 Answer 1


Just use StringForm:

PrintMessage[mess_, val__] := Print@StringForm[mess, val]

Or StringTemplate:

PrintMessage[mess_, val__] := Print@StringTemplate[mess][val]
  • $\begingroup$ Thanks, I was digging around in the docs but didn't stumble on either of these. $\endgroup$
    – Chris K
    Oct 19, 2020 at 2:35

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.