Developing Apama Applications > Apama EPL Reference > Lexical Elements > Literals > String literals
String literals
A string literal is a sequence of characters enclosed in double quotes.
StringLiteral
The backslash character is used as an escape character to allow inclusion of special characters such as newlines and horizontal tabs.
The symbol StringChar above means all the characters other than the ASCII doublequote " and the ASCII backslash \.
To include a double quote in a string literal, precede it with a \ character which serves as an escape character, which means "do not treat this quote as the end of the string literal". To include a newline, use \n. To include a tab character, use \t. To include a single \ character, use two: \\. The compiler will remove the extra backslashes.
Examples
s := "Hello, World!";
s := "\ta\tstring\twith\ttabs\tbetween\twords";
s := "a string on\n two lines";
s := "a string with \\ a backslash and a \" quote";
The length of a string literal is limited only by available memory at compile time andruntime. In practice, this means you can make them as long as you need.
Copyright © 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.