Extensions.StringUtil.ReplaceSubString

From emotive
Jump to navigation Jump to search

Classification

Name ReplaceSubString
Short Description Replacing strings
Class Term
Extension OTX StringUtil extension
Group StringUtil related terms
Exceptions OutOfBoundsException
Checker Rules -
Standard Compliant Yes

OTL Syntax

StringTerm StringUtil.ReplaceSubString(StringTerm string, StringTerm replacement, NumericTerm index);

Description

ReplaceSubString term will yield a new string value which is constructed out of an original string whose contents are overwritten by a replacement string, starting at a given position. If the replacement exceeds the right end of the original string, the length of the resulting string is expanded accordingly.

Return Value

The Term returns the value, see table below.

Icons Note.png In OTX, Terms are categorized according to its return data type!
Data Type Description
String The replacement string

Properties

Name Data Type Class Default Cardinality Description
String String Term - [1] Represents the original String.
Replacement String Term - [1] Represents the String value that will replace the part starting at index of the original String.
Index Numeric Term - [1] The Integer value represents the position in the original String where the replacement starts (the first character in the original String has the index zero). Float values will be truncated.

OTL Examples

/// Local Declarations

String String1;

/// Flow

String1 = StringUtil.ReplaceSubString("emotive company", "COMPANY", 8);

See also

MatchToRegularExpression
StringConcatenate
SubString
LengthOfString
IndexOf
SplitString
ToUpper
ToLower
Encode
Decode