Start page / Template development / Template syntax / Data types / String (text)

String data type

Value range of the String data type

FirstSpirit makes the data type String available for editing values which represent a fixed or variable length text. A string contains a character string consisting of a sequence of characters (e.g. letters, digits, special characters and control characters) from a defined character set. The order of the characters is defined by the character chain. All characters can be repeated within a character chain as many times as required.

The data type string can also be looked up in the Java API documentation:

java.lang.String

Definition

In FirstSpirit, when a string is defined a string object in the class java.lang.String is generated.

$CMS_SET(myString, "That is a text.")$

Definition using the standard input components

Within the form area of templates, input components are defined which can be subsequently used by the editors to insert the actual editorial contents into the page. The standard input components supported by FirstSpirit return different data types.

The following standard input components return an object of data type string:

With the help of a $CMS_VALUE(...)$ instruction, methods can then be applied to this object:

$CMS_VALUE(IDENTIFIER.METHOD)$

Methods on string objects

The table below lists all methods which can be invoked on objects of data type string.

The object is generated by the following form objects:
CMS_INPUT_TEXT
FS_SITESTORE_VARIABLE_VALUE
CMS_INPUT_TEXTAREA
Method name Return type Brief description Available since
charAt(int) char
charAt(Number) char 3.1
chars Iterator 4.2.14
codePointAt(int) int
codePointBefore(int) int
codePointCount(int, int) int
codePoints IntStream
compare(CharSequence, CharSequence) int
compareTo(String) int Lexicographic comparison of two strings
compareTo(CharSequence) int
compareTo(Object) int
compareToIgnoreCase(String) int
concat(String) String
contains(String) boolean Checks whether a sub-character string is contained within the character string 3.1
contains(CharSequence) boolean
contentEquals(StringBuffer) boolean
contentEquals(CharSequence) boolean
convert String Convert special characters into HTML characters (convert) 3.1
convert(String) CharSequence applies the specified convertion table 4.0.53
convert2 String Convert special characters into HTML characters (convert + quote) 3.1
convert2(String) CharSequence applies the specified convertion table in 'quote' mode 4.0.53
copyValueOf(char[]) String
copyValueOf(char[], int, int) String
describeConstable Optional
encode String Returns an encoded representation of a string that follows the rules for HTML id-attributes. 4.2.14
endsWith(String) boolean
equals(String) boolean Checks whether two character strings are identical
equals(Option) boolean
equals(CharSequence) boolean
equals(Object) boolean
equalsIgnoreCase(String) boolean Checks whether two character strings are identical
format(String, Object[]) String
format(Locale, String, Object[]) String
formatted(Object[]) String
get(Range) String 4.0
get(Number) String 4.0
getBytes byte[]
getBytes(Charset) byte[]
getBytes(String) byte[]
getChars(int, int, char[], int) void
getClass Class Class of the invoking object
getExtension String Returns the file extension, e.g. 'txt' for 'info.txt'. The empty string is returned if the text contains no dot. 4.2.34
indent(int) String
indexOf(int) int
indexOf(String) int First occurrence of a sub-character string
indexOf(int, int) int
indexOf(String, int) int
intern String
isBlank boolean
isCase(String) boolean
isCase(Option) boolean
isCase(CharSequence) boolean
isCase(Object) boolean
isEmpty boolean Checks whether an expression is empty 4.0.0
isLower boolean Test if a string contains all lower case letters. 4.2.14
isNull boolean Checks whether an expression is null (zero)
isUpper boolean Test if a string contains all upper case letters. 4.2.14
iterator Iterator
join(CharSequence, CharSequence[]) String
join(CharSequence, Iterable) String
lastIndexOf(int) int
lastIndexOf(String) int Last occurrence of a sub-character string
lastIndexOf(int, int) int
lastIndexOf(String, int) int
length int
lines Stream
lowerCase String Convert character string into lower case letters 3.1
matches(String) boolean
offsetByCodePoints(int, int) int
parse TemplateDocument 4.0
parseExpression Expression 4.0
plain PlainString Creates a PlainString instance for the given string. 4.2.436
plus(Printable) String 4.0
print void
quoteJS String quote as JavaScript source (' -> \', " -> \", CR -> \n) 4.0.54
regionMatches(int, String, int, int) boolean
regionMatches(boolean, int, String, int, int) boolean
repeat(int) String
replace(char, char) String
replace(CharSequence, CharSequence) String
replaceAll(String, String) String
replaceFirst(String, String) String
resolveConstantDesc(MethodHandles$Lookup) String
sentences Iterator 4.0.0
set(String, Object) Object
set(Number, CharSequence) String 4.0
split(String) String[] 4.0
split(String, int) String[]
split(String, Number) String[] 4.0
startsWith(String) boolean Checks whether a text starts with a special character string
startsWith(String, int) boolean Checks text for a string at a particular location
strip String
stripIndent String
stripLeading String
stripTrailing String
subSequence(int, int) CharSequence
subString(Number) String Output sub-character string
subString(int, int) String 3.1
subString(Number, Number) String Output sub-character string
substring(int) String Output sub-character string
substring(Number) String Output sub-character string 3.1
substring(int, int) String Output sub-character string
substring(Number, Number) String Output sub-character string 3.1
toCharArray char[]
toDate(String) Date 4.0
toJSON String Convert to a JSON-compatible string representation including necessary quotes and escaping for immediate use. Handles Maps, Collections, Arrays, Numbers, Strings, Boolean, Date, and JsonElement. A date instance will be converted to an ISO-8601 formatted date string. Any object other than above will be converted using its 'toString()' value. 5.2.11
toLowerCase String Convert character string into lower case letters
toLowerCase(Locale) String
toNumber Number Convert character string into a number 3.1
toString String
toUpperCase String Convert character string into upper case letters
toUpperCase(Locale) String
transform(Function) Object
translateEscapes String
trim String Removing whitespaces
type String
upperCase String Convert character string into upper case letters 3.1
urlEncode String Convert special characters into ASCII character sequences 4.0.0
urlEncode(String) String Convert special characters into ASCII character sequences 4.0.0
valueOf(long) String
valueOf(int) String
valueOf(float) String
valueOf(double) String
valueOf(char) String
valueOf(boolean) String
valueOf(char[]) String
valueOf(Object) String
valueOf(char[], int, int) String
words Iterator 4.0.0
xmlEscape String Replaces XML-specific characters with their respective entities. 5.1.14

charAt(int)

Method name Return type Available since
charAt(int) char

charAt(Number)

Method name Return type Available since
charAt(Number) char 3.1

chars

Method name Return type Available since
chars Iterator 4.2.14

codePointAt(int)

Method name Return type Available since
codePointAt(int) int

codePointBefore(int)

Method name Return type Available since
codePointBefore(int) int

codePointCount(int, int)

Method name Return type Available since
codePointCount(int, int) int

codePoints

Method name Return type Available since
codePoints IntStream

compare(CharSequence, CharSequence)

Method name Return type Available since
compare(CharSequence, CharSequence) int

compareTo(String)

The .compareTo(String) (in Bean syntax: .compareTo(String)) method returns a lexicographic comparison of two strings (cf. java.lang.String). The method returns a positive value if the string is lexicographically larger than the transferred string and a negative value if the string is lexicographically smaller. The method returns 0 if the transferred string is identical to the invoking string.

Invocation:

$CMS_SET(myString, "Das ist ein String.")$
$CMS_VALUE(myString.compareTo("Das ist ein String"))$

Output:

1
Method name Return type Available since
compareTo(String) int

compareTo(CharSequence)

Method name Return type Available since
compareTo(CharSequence) int

compareTo(Object)

Method name Return type Available since
compareTo(Object) int

compareToIgnoreCase(String)

Method name Return type Available since
compareToIgnoreCase(String) int

concat(String)

Method name Return type Available since
concat(String) String

contains(String)

The .contains(String) (in Bean syntax: .contains(String)) method returns true if the transferred sub-string is found in the character string at least once or false if the sub-string is not found (cf. java.lang.String). It is case sensitive, i.e. a differentiation is made between upper and lower case letters.

Invocation:

$CMS_SET(myString, "Das ist ein String.")$
$CMS_VALUE(myString.contains("ein"))$

Output:

true
Method name Return type Available since
contains(String) boolean 3.1

contains(CharSequence)

Method name Return type Available since
contains(CharSequence) boolean

contentEquals(StringBuffer)

Method name Return type Available since
contentEquals(StringBuffer) boolean

contentEquals(CharSequence)

Method name Return type Available since
contentEquals(CharSequence) boolean

convert

The .convert() (in Bean syntax: .convert) converts special characters contained in a character string into HTML characters for the output. When using .convert() the conversion rules in the convert area of the selected conversion rule of the template set are used.

Method name Return type Available since
convert String 3.1

convert(String)

applies the specified convertion table
Method name Return type Available since
convert(String) CharSequence 4.0.53

convert2

The .convert2() (in Bean syntax: .convert2) converts special characters contained in a character string into HTML characters for the output. When using .convert2() the conversion rules in the convert and quote area of the selected conversion rule of the template set are used.

Method name Return type Available since
convert2 String 3.1

convert2(String)

applies the specified convertion table in 'quote' mode
Method name Return type Available since
convert2(String) CharSequence 4.0.53

copyValueOf(char[])

Method name Return type Available since
copyValueOf(char[]) String

copyValueOf(char[], int, int)

Method name Return type Available since
copyValueOf(char[], int, int) String

describeConstable

Method name Return type Available since
describeConstable Optional

encode

Returns an encoded representation of a string that follows the rules for HTML id-attributes.
Method name Return type Available since
encode String 4.2.14

endsWith(String)

Method name Return type Available since
endsWith(String) boolean

equals(String)

The .equals(String) (in Bean syntax: .equals(String)) method checks whether a string is the same as a transferred string (cf. java.lang.String). It is case sensitive, i.e. a differentiation is made between upper and lower case letters.

Invocation:

$CMS_SET(myString, "Das ist ein String.")$
$CMS_VALUE(myString.equals("Das ist ein String."))$

Output:

true
Method name Return type Available since
equals(String) boolean

equals(Option)

Method name Return type Available since
equals(Option) boolean

equals(CharSequence)

Method name Return type Available since
equals(CharSequence) boolean

equals(Object)

Method name Return type Available since
equals(Object) boolean

equalsIgnoreCase(String)

The .equalsIgnoreCase(String) (in Bean syntax: .equalsIgnoreCase(String)) method checks whether a string is the same as a transferred string (cf. java.lang.String). There is no - unlike the .equals(String) method - case sensitivity, i.e. there is no differentiation between upper and lower case letters.

Invocation:

$CMS_SET(myString, "DAS ist EIN String.")$
$CMS_VALUE(myString.equals("Das ist ein String."))$

Output:

true
Method name Return type Available since
equalsIgnoreCase(String) boolean

format(String, Object[])

Method name Return type Available since
format(String, Object[]) String

format(Locale, String, Object[])

Method name Return type Available since
format(Locale, String, Object[]) String

formatted(Object[])

Method name Return type Available since
formatted(Object[]) String

get(Range)

Method name Return type Available since
get(Range) String 4.0

get(Number)

Method name Return type Available since
get(Number) String 4.0

getBytes

Method name Return type Available since
getBytes byte[]

getBytes(Charset)

Method name Return type Available since
getBytes(Charset) byte[]

getBytes(String)

Method name Return type Available since
getBytes(String) byte[]

getChars(int, int, char[], int)

Method name Return type Available since
getChars(int, int, char[], int) void

getClass

The .getClass() (in Bean syntax: .class) method returns the class of the invoking object (cf. java.lang.Class).

Invocation:

$CMS_VALUE(myString.class)$
$CMS_VALUE(myString.getClass())$

Output:

java.lang.String
Method name Return type Available since
getClass Class

getExtension

Returns the file extension, e.g. 'txt' for 'info.txt'. The empty string is returned if the text contains no dot.
Method name Return type Available since
getExtension String 4.2.34

indent(int)

Method name Return type Available since
indent(int) String

indexOf(int)

Method name Return type Available since
indexOf(int) int

indexOf(String)

The .indexOf(String) (in Bean syntax: .indexOf(String)) method returns an index of the character string at which the first character of a sub-string is found or -1 if the transferred sub-string is not found in the character string (cf. java.lang.String). It is case sensitive, i.e. a differentiation is made between upper and lower case letters.

Invocation:

$CMS_SET(myString, "Das ist ein String.")$
$CMS_VALUE(myString.indexOf("ein")$

Output:

8
Method name Return type Available since
indexOf(String) int

indexOf(int, int)

Method name Return type Available since
indexOf(int, int) int

indexOf(String, int)

Method name Return type Available since
indexOf(String, int) int

intern

Method name Return type Available since
intern String

isBlank

Method name Return type Available since
isBlank boolean

isCase(String)

Method name Return type Available since
isCase(String) boolean

isCase(Option)

Method name Return type Available since
isCase(Option) boolean

isCase(CharSequence)

Method name Return type Available since
isCase(CharSequence) boolean

isCase(Object)

Method name Return type Available since
isCase(Object) boolean

isEmpty

The .isEmpty() (in Bean syntax: .isEmpty) method checks whether an expression or object is empty, e.g. storeElement.isEmpty(). The result of the semantic check depends on the expression or object, e.g. a character string is empty if it does not contain any characters. In the case of objects with complex values or objects, the object decides when it is empty. The data type DomElement for example always contains an empty document, thus it is never null. For this reason, checking an empty DOM editor input component by using the method .isNull() returns the value false, whereas checking the component with .isEmpty() would return the value true.

The method .isEmpty() returns a Boolean value as the check result. true is the check result if the expression or object is empty and false if not.

Method name Return type Available since
isEmpty boolean 4.0.0

isLower

Test if a string contains all lower case letters.
Method name Return type Available since
isLower boolean 4.2.14

isNull

The .isNull() (in Bean syntax: .isNull) method checks whether an expression or object is null , e.g. storeElement.isNull(). In the case of objects with complex values or objects, the object decides when it is null. The data type DomElement for example always contains an empty document, thus it is never null. For this reason, checking an empty DOM editor input component by using the method .isNull() returns the value false, whereas checking the component with .isEmpty() would return the value true.

The method .isNull() returns a Boolean value as the check result. true is the check result if the expression or object is null and false if not.

Method name Return type Available since
isNull boolean

isUpper

Test if a string contains all upper case letters.
Method name Return type Available since
isUpper boolean 4.2.14

iterator

Method name Return type Available since
iterator Iterator

join(CharSequence, CharSequence[])

Method name Return type Available since
join(CharSequence, CharSequence[]) String

join(CharSequence, Iterable)

Method name Return type Available since
join(CharSequence, Iterable) String

lastIndexOf(int)

Method name Return type Available since
lastIndexOf(int) int

lastIndexOf(String)

The .lastIndexOf(String) (in Bean syntax: .lastIndexOf(String)) method returns an index of the character string at which the first character of a sub-string is found or -1 if the transferred sub-string is not found in the character string (cf. java.lang.String). It is case sensitive, i.e. a differentiation is made between upper and lower case letters.

Unlike the .indexOf(String) method the index of the last and not the first occurrence is returned.

Invocation:

$CMS_SET(myString, "Das ist ein String.")$
$CMS_VALUE(myString.lastIndexOf("ein")$

Output:

8
Method name Return type Available since
lastIndexOf(String) int

lastIndexOf(int, int)

Method name Return type Available since
lastIndexOf(int, int) int

lastIndexOf(String, int)

Method name Return type Available since
lastIndexOf(String, int) int

length

Method name Return type Available since
length int

lines

Method name Return type Available since
lines Stream

lowerCase

The .lowerCase() (in Bean syntax: .lowerCase) method converts all characters in the character string into lower case letters (cf. java.lang.String).

Invocation:

$CMS_SET(myString, "Das ist ein String.")$
$CMS_VALUE(myString.lowerCase)$

Output:

that is a string.
Method name Return type Available since
lowerCase String 3.1

matches(String)

Method name Return type Available since
matches(String) boolean

offsetByCodePoints(int, int)

Method name Return type Available since
offsetByCodePoints(int, int) int

parse

Method name Return type Available since
parse TemplateDocument 4.0

parseExpression

Method name Return type Available since
parseExpression Expression 4.0

plain

Creates a PlainString instance for the given string.
Method name Return type Available since
plain PlainString 4.2.436

plus(Printable)

Method name Return type Available since
plus(Printable) String 4.0

print

Method name Return type Available since
print void

quoteJS

quote as JavaScript source (' -> \', " -> \", CR -> \n)
Method name Return type Available since
quoteJS String 4.0.54

regionMatches(int, String, int, int)

Method name Return type Available since
regionMatches(int, String, int, int) boolean

regionMatches(boolean, int, String, int, int)

Method name Return type Available since
regionMatches(boolean, int, String, int, int) boolean

repeat(int)

Method name Return type Available since
repeat(int) String

replace(char, char)

Method name Return type Available since
replace(char, char) String

replace(CharSequence, CharSequence)

Method name Return type Available since
replace(CharSequence, CharSequence) String

replaceAll(String, String)

Method name Return type Available since
replaceAll(String, String) String

replaceFirst(String, String)

Method name Return type Available since
replaceFirst(String, String) String

resolveConstantDesc(MethodHandles$Lookup)

Method name Return type Available since
resolveConstantDesc(MethodHandles$Lookup) String

sentences

Method name Return type Available since
sentences Iterator 4.0.0

set(String, Object)

Method name Return type Available since
set(String, Object) Object

set(Number, CharSequence)

Method name Return type Available since
set(Number, CharSequence) String 4.0

split(String)

Method name Return type Available since
split(String) String[] 4.0

split(String, int)

Method name Return type Available since
split(String, int) String[]

split(String, Number)

Method name Return type Available since
split(String, Number) String[] 4.0

startsWith(String)

The method checks whether a string of characters (e.g. a text) starts with a special character string, also refer to java.lang.String

The check starts with the first character. To have the check start at a different character in the text, this can be done using the startsWith(String, int) method.

This method returns a Boolean value as the result of the check. The check is true if the saved text matches the string of characters specified in the method and false if it does not.

Example:
The following example checks whether the input starts with the string "Hello". If it does not, a "Hello" is placed in front of the output.

$CMS_IF(!text.startsWith("Hello"))$
Hello $CMS_VALUE(text)$

$CMS_ELSE$
$CMS_VALUE(text)$

$CMS_END_IF$

If Hello Anna is the input, then the output is not changed:

Hello Anna

If only Anna has been entered, "Hello" is added. The output is then

Hello Anna
Method name Return type Available since
startsWith(String) boolean

startsWith(String, int)

This method checks whether a saved text contains a special string at a particular location, also refer to java.lang.String

The passed number (int) specifies at which character the check should proceed. The counting starts with 0; the location of the first character of the text to be checked is therefore 0, the second is 1, etc.

This method returns a Boolean value as the result of the check. The check is true if the saved text matches the string specified in the method at the specified location and false if it does not.

For instance, the following syntax can be used to check whether the second and third characters of the text input in a text input component is "al":

Are the second and third character of the entered text "al"? </br>
$CMS_IF(text.startsWith("al", 1))$
=> That's right.
$CMS_ELSE$
=> That's wrong.
$CMS_END_IF$

If the text saved in the text variable is false, "=> That's right." is output; otherwise, "=> That's wrong." is output.

Method name Return type Available since
startsWith(String, int) boolean

strip

Method name Return type Available since
strip String

stripIndent

Method name Return type Available since
stripIndent String

stripLeading

Method name Return type Available since
stripLeading String

stripTrailing

Method name Return type Available since
stripTrailing String

subSequence(int, int)

Method name Return type Available since
subSequence(int, int) CharSequence

subString(Number)

The .subString(Number) (in Bean syntax: .subString(Number)) outputs a sub-character string (cf. java.lang.String). The transferred number specified from which character the output should start (= first character).

Invocation:

$CMS_SET(myString, "Das ist ein String.")$
$CMS_VALUE(myString.subString(1))$

Output:

as ist ein String.
Method name Return type Available since
subString(Number) String

subString(int, int)

Method name Return type Available since
subString(int, int) String 3.1

subString(Number, Number)

The .subString(Number, Number) (in Bean syntax: .subString(Number, Number)) method outputs a sub-character string (cf. java.lang.String). The first transferred number specifies from which character (first character) and the second number up to which character (last character) the character string is to be output.

Invocation:

$CMS_SET(myString, "Das ist ein String.")$
$CMS_VALUE(myString.subString(1, 12))$

Output:

as ist ein
Method name Return type Available since
subString(Number, Number) String

substring(int)

The .substring(int) (in Bean syntax: .substring(int)) method outputs a sub-character string (cf. java.lang.String). The transferred number specified from which character the output should start (= first character).

Invocation:

$CMS_SET(myString, "Das ist ein String.")$
$CMS_VALUE(myString.substring(1))$

Output:

as ist ein String.
Method name Return type Available since
substring(int) String

substring(Number)

The .substring(Number) (in Bean syntax: .substring(Number)) outputs a sub-character string (cf. java.lang.String). The transferred number specified from which character the output should start (= first character).

Invocation:

$CMS_SET(myString, "Das ist ein String.")$
$CMS_VALUE(myString.substring(1))$

Output:

as ist ein String.
Method name Return type Available since
substring(Number) String 3.1

substring(int, int)

The .substring(int, int) (in Bean syntax: .substring(int, int)) method outputs a sub-character string (cf. java.lang.String). The first transferred number specifies from which character (first character) and the second number up to which character (last character) the character string is to be output.

Invocation:

$CMS_SET(myString, "Das ist ein String.")$
$CMS_VALUE(myString.substring(1, 12))$

Output:

as ist ein
Method name Return type Available since
substring(int, int) String

substring(Number, Number)

The .substring(Number, Number) (in Bean syntax: .substring(Number, Number)) method outputs a sub-character string (cf. java.lang.String). The first transferred number specifies from which character (first character) and the second number up to which character (last character) the character string is to be output.

Invocation:

$CMS_SET(myString, "Das ist ein String.")$
$CMS_VALUE(myString.substring(1, 12))$

Output:

as ist ein
Method name Return type Available since
substring(Number, Number) String 3.1

toCharArray

Method name Return type Available since
toCharArray char[]

toDate(String)

Method name Return type Available since
toDate(String) Date 4.0

toJSON

Convert to a JSON-compatible string representation including necessary quotes and escaping for immediate use. Handles Maps, Collections, Arrays, Numbers, Strings, Boolean, Date, and JsonElement. A date instance will be converted to an ISO-8601 formatted date string. Any object other than above will be converted using its 'toString()' value.
Method name Return type Available since
toJSON String 5.2.11

toLowerCase

The .toLowerCase() (in Bean syntax: .toLowerCase) method converts all characters in the character string into lower case letters (cf. java.lang.String).

Invocation:

$CMS_SET(myString, "Das ist ein String.")$
$CMS_VALUE(myString.toLowerCase())$

Output:

that is a string.
Method name Return type Available since
toLowerCase String

toLowerCase(Locale)

Method name Return type Available since
toLowerCase(Locale) String

toNumber

The .toNumber() (in Bean syntax: .toNumber) method converts the data type string (character string) into the data type Number (cf. java.lang.String). This is only possible if the character chain consists of digits.

Invocation:

$CMS_VALUE("5".toNumber())$

Output:

5
Method name Return type Available since
toNumber Number 3.1

toString

Method name Return type Available since
toString String

toUpperCase

The .toUpperCase() (in Bean syntax: .toUpperCase) method converts all characters in the character string into upper case letters (cf. java.lang.String).

Invocation:

$CMS_SET(myString, "Das ist ein String.")$
$CMS_VALUE(myString.toUpperCase())$

Output:

THAT IS A STRING.
Method name Return type Available since
toUpperCase String

toUpperCase(Locale)

Method name Return type Available since
toUpperCase(Locale) String

transform(Function)

Method name Return type Available since
transform(Function) Object

translateEscapes

Method name Return type Available since
translateEscapes String

trim

The .trim() (in Bean syntax: .trim) method removes whitespaces at the beginning and at the end of the character string (cf. java.lang.String).

Invocation:

$CMS_SET(myString, "\tDas ist ein String.\n")$
$CMS_VALUE(myString.trim())$

Output:

That is a string.
Method name Return type Available since
trim String

type

Method name Return type Available since
type String

upperCase

The .upperCase() (in Bean syntax: .upperCase()) method converts all characters in the character string into upper case letters (cf. java.lang.String).

Invocation:

$CMS_SET(myString, "Das ist ein String.")$
$CMS_VALUE(myString.upperCase)$

Output:

THAT IS A STRING.
Method name Return type Available since
upperCase String 3.1

urlEncode

The .urlEncode() (in Bean syntax: .urlEncode) method can be used to convert a character string into ASCII character sequences. The conversion is also called encode or encoding. A % symbol followed by two characters is typical for such character sequences. The MIME type for a converted character string is application/x-www-form-urlencoded.

The following characters are not taken into account in the conversion:

A-Z  a-z 0-9 . - * _

Space characters are converted into plus signs.

The following encoding is used for the conversion: UTF-8.

The invocation:

$CMS_VALUE("Müller@e-Spirit.com".urlEncode)$

results in the converted character string:

M%C3%BCller%40e-Spirit.com

Cf. also java.net.URLEncoder

Method name Return type Available since
urlEncode String 4.0.0

urlEncode(String)

The .urlEncode() (in Bean syntax: .urlEncode) method can be used to convert a character string into ASCII character sequences. The conversion is also called encode or encoding. A % symbol followed by two characters is typical for such character sequences. The MIME type for a converted character string is application/x-www-form-urlencoded.

.urlEncode() uses UTF-8 for the conversion.
Use .urlEncode(String) to indicate a special encoding.

For example, the invocation

$CMS_VALUE("Müller@e-Spirit.com".urlEncode("ISO-8859-1"))$

results in the converted character string:

M%FCller%40e-Spirit.com
Method name Return type Available since
urlEncode(String) String 4.0.0

valueOf(long)

Method name Return type Available since
valueOf(long) String

valueOf(int)

Method name Return type Available since
valueOf(int) String

valueOf(float)

Method name Return type Available since
valueOf(float) String

valueOf(double)

Method name Return type Available since
valueOf(double) String

valueOf(char)

Method name Return type Available since
valueOf(char) String

valueOf(boolean)

Method name Return type Available since
valueOf(boolean) String

valueOf(char[])

Method name Return type Available since
valueOf(char[]) String

valueOf(Object)

Method name Return type Available since
valueOf(Object) String

valueOf(char[], int, int)

Method name Return type Available since
valueOf(char[], int, int) String

words

Method name Return type Available since
words Iterator 4.0.0

xmlEscape

Replaces XML-specific characters with their respective entities.
Method name Return type Available since
xmlEscape String 5.1.14

© 2005 - 2024 Crownpeak Technology GmbH | All rights reserved. | FirstSpirit 2024.12 | Data privacy