slang-users mailing list

[2019 Date Index] [2019 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [slang-users] Special characters in multiline strings


Bernd Eggink <bernd.eggink@xxxxxxxxxx> wrote:
> Are special characters (\n, \e etc.) supposed to work in multiline 
> strings? The documentation doesn't say the opposite, but actually this:
>
> 	printf(`one\ntwo\nthree\n`);
>
> displays:
>
> 	one\ntwo\nthree\n

By default, there is no special processing of backslash characters in
backquote-delimited strings.  This makes such strings useful for
regular expressions.  If a backquote-delimited string is given the Q
suffix, then backslash processing will take place.  You can see this
using slsh:

  slsh> `one\ntwo\nthree\n`;
  one\ntwo\nthree\n
  slsh> `one\ntwo\nthree\n`Q;
  one
  two
  three

Note that if a backquote character is to be included in a backquote-delimited
string, then it must be doubled:

  slsh> `One backquote: ```;
  One backquote: `
  slsh> `Two backquotes: `````;
  Two backquotes: ``

I hope this helps.
Thanks,
--John
_______________________________________________
For list information, visit <http://jedsoft.org/slang/mailinglists.html>.


[2019 date index] [2019 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]