How it works

The Instruction operation "left" returns a specified number of characters from the left side of the first input string. Subsequent input(s) determine the number of characters "n".

If the specified number of characters is negative then the string returned is the original string with the specified number of characters removed from the end. Or another way to look at it is; that a "-n" left value, is in effect a "n" right value, so simple arithmetics.

"Left" Examples

Example 1: Positive "n"

The example below has the input value of 4, so it returns "abcd" as they are the first four characters.

<instruction operation="left">
	<input value="abcdefghijk" />
	<input value="4" />
</instruction>
abcd

Example 2: Negative "n"

The example below has the input value of -4, so it removes "hijk" and returns "abcdgh". This is equivalent to a positive value of "4" for the right operation.

<instruction operation="left">
	<input value="abcdefghijk" />
	<input value="-4" />
</instruction>
abcdefg

Example 3: Multiple inputs

The example below has two numerical inputs after our ten letter string, the first with value 6 and the second with the negative value of -2, as they are processed consecutively, this becomes 4 as (6 - 2 = 4), so we have the same result as in example 1 "abcd". A -6 right operation would return the same result.

<instruction operation="left">
	<input value="abcdefghijk" />
	<input value="6" />
	<input value="-2" />
</instruction>
abcd



Last Modified: Thu, 15 Jan 2015