Difference between revisions of "Extensions.StringUtil.ReplaceSubString"

From emotive
Jump to navigation Jump to search
 
(7 intermediate revisions by one other user not shown)
Line 1: Line 1:
[[Category:StringUtil]]
+
{{DISPLAYTITLE:'''ReplaceSubString '''}}[[Category:StringUtil]]
 
== Classification ==
 
== Classification ==
{{ClassificationActivity | ReplaceSubString | Replacing strings | [[Term]] | [[StringUtil|OTX StringUtil extension]] | [[StringUtil related terms]] | [[OutOfBoundsException]] | - }}
+
{{ClassificationActivity | ReplaceSubString | Replacing strings | [[Term]] | [[Extensions.StringUtil|OTX StringUtil extension]] | [[Extensions.StringUtil#Terms|StringUtil related terms]] | [[Core.DataTypes.ComplexDataType.OutOfBoundsException|OutOfBoundsException]] | - }}
  
 
== OTL Syntax ==
 
== OTL Syntax ==
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
StringTerm = ReplaceSubString(StringTerm, StringTerm, IntegerTerm);
+
StringTerm StringUtil.ReplaceSubString(StringTerm string, StringTerm replacement, NumericTerm index);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
== Description ==
 
== Description ==
'''ReplaceSubString''' term replaced the strings with ''replacement'' string, starting at the specified position (''index'') within a strings and returns the result.  
+
'''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.
  
{{TermReturnValue| [[String]] | The replacement string}}
+
{{TermReturnValue| [[Core.DataTypes.SimpleDataType.String|String]] | The replacement string}}
  
 
== Properties ==
 
== Properties ==
 
{| {{TableHeader}}
 
{| {{TableHeader}}
 
{{TableRowPropertiesHeader}}
 
{{TableRowPropertiesHeader}}
{{TableRowPropertie1| String | [[String]] | [[Term]] | - | [1] | The original string}}
+
{{TableRowPropertie2| String | [[Core.DataTypes.SimpleDataType.String|String]] | [[Term]] | - | [1] | Represents the original '''String'''.}}
{{TableRowPropertie2| Replacement | [[String]] | [[Term]] | - | [1] | The string that replaces a portion of the original string starting at the specified position}}
+
{{TableRowPropertie1| Replacement | [[Core.DataTypes.SimpleDataType.String|String]] | [[Term]] | - | [1] | Represents the '''String''' value that will replace the part starting at '''index''' of the original '''String'''.}}
{{TableRowPropertie1| Index | [[Iteger]] | [[Term]] | - | [1] | The zero-based position of the original string, from which starts the replacement}}
+
{{TableRowPropertie2| 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 ==
 
== OTL Examples ==
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 +
/// Local Declarations
 +
 
String String1;
 
String String1;
  
String1 = ReplaceSubString("emotive company", "COMPANY", 8);
+
/// Flow
 +
 
 +
String1 = StringUtil.ReplaceSubString("emotive company", "COMPANY", 8);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
== See also ==
 
== See also ==
[[MatchToRegularExpression]] <br/>
+
<!--[[Extensions.StringUtil.ReplaceSubString|ReplaceSubString]]<br/>-->
[[StringConcatenate]] <br/>
+
[[Extensions.StringUtil.MatchToRegularExpression|MatchToRegularExpression]] <br/>
[[SubString]] <br/>
+
[[Extensions.StringUtil.StringConcatenate|StringConcatenate]] <br/>
[[LengthOfString]] <br/>
+
[[Extensions.StringUtil.SubString|SubString]] <br/>
[[IndexOf]] <br/>
+
[[Extensions.StringUtil.LengthOfString|LengthOfString]] <br/>
[[SplitString]] <br/>
+
[[Extensions.StringUtil.IndexOf|IndexOf]] <br/>
[[ToUpper]] <br/>
+
[[Extensions.StringUtil.SplitString|SplitString]] <br/>
[[ToLower]] <br/>
+
[[Extensions.StringUtil.ToUpper|ToUpper]] <br/>
[[Encode]] <br/>
+
[[Extensions.StringUtil.ToLower|ToLower]] <br/>
[[Decode]]
+
[[Extensions.StringUtil.Encode|Encode]] <br/>
 +
[[Extensions.StringUtil.Decode|Decode]]

Latest revision as of 03:16, 13 September 2019

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