Difference between revisions of "Extensions.StringUtil.Encode"

From emotive
Jump to navigation Jump to search
Line 1: Line 1:
 
{{DISPLAYTITLE:'''Encode '''}}[[Category:StringUtil]]
 
{{DISPLAYTITLE:'''Encode '''}}[[Category:StringUtil]]
 
== Classification ==
 
== Classification ==
{{ClassificationActivity | Encode | Encodes a string | [[Term]] | [[Extensions.StringUtil|OTX StringUtil extension]] | [[StringUtil related terms]] | [[Core.Actions.Throw.Exception.UnsupportedEncodingException|UnsupportedEncodingException]] <br/> [[Core.Actions.Throw.Exception.OutOfBoundsException|OutOfBoundsException]] | - }}
+
{{ClassificationActivity | Encode | Encodes a string | [[Term]] | [[Extensions.StringUtil|OTX StringUtil extension]] | [[Extensions.StringUtil#Terms|StringUtil related terms]] | [[Extensions.StringUtil.UnsupportedEncodingException|UnsupportedEncodingException]] <br/> [[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;">
ByteFieldTerm = Encode(StringTerm, EncodingType);
+
ByteFieldTerm = StringUtil.Encode(EncodingTerm, StringTerm);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
== Description ==
 
== Description ==
The '''Encode''' term encodes the specified string corresponding to the specified encoding and returns a '''ByteField''' as a result.
+
The '''Encode''' term shall encode a '''String''' by using a given encoding. The result is a '''ByteField''' representing the encoded string.
  
 
{{TermReturnValue| [[Core.DataTypes.ComplexDataType.ByteField|ByteField]] | Encoded string according to the given encoding.}}
 
{{TermReturnValue| [[Core.DataTypes.ComplexDataType.ByteField|ByteField]] | Encoded string according to the given encoding.}}
Line 16: Line 16:
 
{| {{TableHeader}}
 
{| {{TableHeader}}
 
{{TableRowPropertiesHeader}}
 
{{TableRowPropertiesHeader}}
{{TableRowPropertie1| String | [[Core.DataTypes.SimpleDataType.String|String]] | [[Term]] | - | [1] | The original string}}
+
{{TableRowPropertie1| Encoding | [[Extensions.StringUtil.Encoding|Encoding]] | [[Term]] | @Encoding:US-ASCII | [1] | This represents the encoding to be used. The set of standard encodings which shall be supported by any runtime system is given by the '''Encoding''' enumeration.}}
{{TableRowPropertie1| Encoding | [[Extensions.StringUtil.Encoding|Encoding]] | [[Value]] | @Encoding:US-ASCII | [1] | Encoding is applied to the string}}
+
{{TableRowPropertie2| String | [[Core.DataTypes.SimpleDataType.String|String]] | [[Term]] | - | [1] | Represents the string which shall be transformed to a '''ByteField''' by using the given encoding.}}
 
|}
 
|}
  
 
== OTL Examples ==
 
== OTL Examples ==
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
ByteField result;
+
ByteField ByteField1;
result = Encode("FFFF", @Encoding:US-ASCII);
+
 
 +
/// Flow
 +
 
 +
ByteField1 = StringUtil.Encode(@Encoding:US-ASCII, "FFFF");
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Revision as of 11:24, 3 October 2018

Classification

Name Encode
Short Description Encodes a string
Class Term
Extension OTX StringUtil extension
Group StringUtil related terms
Exceptions UnsupportedEncodingException
OutOfBoundsException
Checker Rules -
Standard Compliant Yes

OTL Syntax

ByteFieldTerm = StringUtil.Encode(EncodingTerm, StringTerm);

Description

The Encode term shall encode a String by using a given encoding. The result is a ByteField representing the encoded string.

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
ByteField Encoded string according to the given encoding.

Properties

Name Data Type Class Default Cardinality Description
Encoding Encoding Term @Encoding:US-ASCII [1] This represents the encoding to be used. The set of standard encodings which shall be supported by any runtime system is given by the Encoding enumeration.
String String Term - [1] Represents the string which shall be transformed to a ByteField by using the given encoding.

OTL Examples

ByteField ByteField1;

/// Flow

ByteField1 = StringUtil.Encode(@Encoding:US-ASCII, "FFFF");

See also

ReplaceSubString
MatchToRegularExpression
StringConcatenate
SubString
LengthOfString
IndexOf
SplitString
ToUpper
ToLower
Decode