How to concatenate strings in gnuplot?

GiniPig picture GiniPig · Mar 21, 2016 · Viewed 10.8k times · Source

Let's say we have two strings:

String1 = 'This is '
String2 = 'a mouse.'

How can I concatenate these 2 strings to form the string 'This is a mouse.' in gnuplot?

Answer

bibi picture bibi · Mar 21, 2016

Given two strings

String1 = 'This is ' 
String2 = 'a mouse.'

To concatenate them, you can use either

String3 = String1.String2

or a more flexible:

String3 = sprintf("%s%s", String1, String2)

type help string or help sprintf for more information about the two methods.