charAt

The charAt task returns a character at a given index. The index of the first character in the string is 0, the second character is 1, and so on. When the index value is specified, the return result will be the character at that index location in the string.

Potential use case

Suppose you have a long list of numbers and you want to verify that a certain number is located at a certain position in the index. You could use the charAt task for that validation.

Properties

IncomingTypeDescription
strStringRequired. The string to get a character from.
indexNumberRequired. The index to get the character at.
OutgoingTypeDescription
characterStringThe single character at the specified index.

Example

In this example:

  • The str reference value is the two-word sentence “Hello World”.
  • The index location is position 1 in the str.
charAt task configured with str Hello World and index 1

The result of this task returns the letter “e” because the character is located in the 1 position of the index. The index starts at 0 and counts up from there.

charAt task output showing the character e at index 1