Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ XR Studio

string

  • Last UpdatedSep 17, 2025
  • 2 minute read

This topic is about the string data type.

Value syntax

"This is a text"

Description

XRS Script language currently supports only regular string literals; that is, zero or more characters enclosed in double quotes. The use of real UTF8 Unicode allows to support a wider range of characters, with respect to the XML Script language.

Autocasting

String type supports automatic conversion for all types.

bool b=true;

vector3 myvec={1,2,3};

string text = "hello" + 2 + b + myvec;

Runtime::Environment.Print(text); //hello2True1 2 3

text += "world";

Runtime::Environment.Print(text); // hello2True1 2 3world

Runtime::Environment.Print("hello" + 3); //hello3

Runtime::Environment.Print(3 + 3); //6

int a = 2;

Runtime::Environment.Print(a); //2

Properties

These are the properties for string.

Property

Return type 

Parameters 

Description 

Length 

int 

 

Used to obtain the length of the string. 

Methods

This table shows the currently implemented methods.

Method 

Return type 

Parameters 

Description 

Contains 

bool 

T value 

Returns true if the string contains the given value, including character case. 

EndsWith 

bool 

T value 

Returns true if the end of the string matches the specified value. 

IndexOf 

int 

T value 

Used to obtain the zero-based index position of the first occurrence of a specified value within the string 

LastIndexOf 

int 

T value 

Used to obtain the zero-based index position of the last occurrence of a specified value within the string. 

Replace 

string 

T value1, T value2 

Returns a new string in which all occurrences of value1 in the string are replaced with value2. 

Split 

List 

T value 

Splits a string into a list of substrings based on value. 

StartsWith

bool

T value

Returns true if the starting of the string matches the specified value.

Substring 

string 

int fromIndex int length 

Returns a new string that contains the substring from given fromIndex of given length. 

ToLowerInvariant 

string 

 

Returns a new string that contains the original string with all lowercase characters. 

ToUpperInvariant 

string 

 

Returns a new string that contains the original string with all uppercase characters. 

Trim 

string 

 

Returns the string value trimmed (remove all the leading and trailing spaces in the string). 

TrimEnd 

string 

 

Returns the string value trimmed (remove all the trailing spaces in the string). 

TrimStart 

string 

 

Returns the string value trimmed (remove all the leading spaces in the string). 

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in