I recently got bit by becoming complacent writing things like
printf "\n%f\n" 3.2
instead of
printf "%s%f%s" Environment.NewLine 3.2 Environment.NewLine
My question is: is there any way to write the safe second version as nicely as the first (i.e. a special character in the format string which inserts Environment.Newline so that an argument for each newline instance in the format string isn’t required)?
How about using kprintf for a double pass, replacing \n with NewLine:
Then in
nprintf "\n%f\n" 3.2all \n get replaced by NewLine.