RIGHT

The RIGHT function outputs the last n characters of the string from the right.

The number of characters returned is specified by the Count property. If the Count property is greater than the number of characters in the string, the entire string is returned.

Input/Output

Number of Connections: Min: 1/Max:2
InputData TypeDescription
Input1StringThe original string.
Input2IntegerSets the Count property. (optional)

OutputData TypeDescription
Output1StringThe sub-string.

Property

NameProperty TypeDescription
CountintThe number of characters from the right of the string to return.
Return empty string, if Count is set to 0.
Return whole string, if Count is bigger than the input string's length.
Modechoice Specifies how to count the length.
String - Count by the number of characters.
Binary - Count by the number of bytes.
EncodingchoiceSpecifies encoding when counting by bytes.

Topic

Handling of the number of characters when the unit is a number of bytes

When "Mode" property is set to Byte, the number of characters is calculated by byte of specified character encoding.
Represents the string "あいうえお" as a Shift JIS and UTF-8,


shift_jis: 82 A0 82 A2 82 A4 82 A6 82 A8
utf-8: E3 81 82 E3 81 84 E3 81 86 E3 81 88 E3 81 8A


For example, you specify "6" as a number of byte in Left function, outputs "あいう" when encoding is shift_jis. Outputs "あい" when encoding is utf-8. If you specify "5", the output is truncated in both encodings. In this case, the string is truncated so that it can be less than specified number. Thus, "あい" (2 letters, 4 bytes) when encoding is shift_jis. "あ"(1 letter, 3 bytes) when encoding is utf-8
(Mid function, start position is shifted below when it is splitted in the letter.)


Note: The expected result is not aquired when the character encoding with ShiftIn/ShiftOut like iso-2022-jp.
Note: The expected result may be not auired when platform is AIX.

Example

PropertyOutput
Input 1Infoteria XML Solution ComponentsCount23XML Solution Components

PropertyOutput
Input1日本語サンプルCount4サンプル