Molding ASCII art
LabVIEW, 37 LabVIEW Primitives
splits the string into text and mold then transforms them into an array. Checks the mold if theres a # and puts a char from text else it does nothing. If either the text or the mold are empty exit the loop
Haskell, 48 bytes
called like "(replace with string)#(hashmark string)":
[]#_=[]
(r:t)#('#':s)=r:t#s
r#(c:s)=c:r#s
_#_=[]
Less golfed:
combine replacements slots | null replacements = []
| null slots = []
| head slots == '#' = head replacements : combine (tail replacements) (tail slots)
| otherwise = head slots : combine replacements (tail slots)
CJam, 16 14 bytes
Thanks to Sp3000 for saving 2 bytes.
lq{s'#-\+(\}/;
Terminates with an error if the string is too short, but the error is printed to STDERR.
Try it online!
Alternatively (same byte count):
lq{SN+&\+(\}/;
Explanation
l e# Read the input line.
q e# Read the grid.
{ e# For each character in the grid...
s e# Convert to string.
'#- e# Remove "#" from it.
\+ e# Prepend it to the input line (this is a no-op for "#"s in the grid).
( e# Pull off the first character from the input line. This will terminate the
e# program with an error once the input line is empty.
\ e# Swap the character with the input line.
}/
; e# Discard the remainder of the input line if there is any.