Alex Rivera | Logout

Postscript: concatenate two strings?

Asked 2012-09-11T22:34:34.133
8

How do I concatenate two strings in Postscript?

(foo) (bar) ??? -> (foobar)
Edit
Report

1 Answer

11

PostScript doesn't have a built-in string concatenation operator. You need to write some code for that. For instance

 /concatstrings % (a) (b) -> (ab)  
   { exch dup length    
     2 index length add string    
     dup dup 4 2 roll copy length
     4 -1 roll putinterval
   } bind def  

(code from https://en.wikibooks.org/wiki/PostScript_FAQ/Programming_PostScript#How_to_concatenate_strings%3F.)

answered 2012-09-12T00:02:57.703

Your Answer