SHIP:Sail:charAt

From Serious Documentation
Jump to: navigation, search
Function Returns Introduced Description
charAt String v4.0 Returns the single character string extracted from a specified index in another string. This is a simplified version of subStr and provided for completeness in the API.

See Also:

Prototype

String charAt(String s, Integer index);

Parameters/Return Value

Parameter Data Type Description
s String String to pull character from
index Integer index in string 0...(length-1)
Return String Single character string at "index" in "s"

Detailed Description

The charAt() function returns the single character string extracted from another string at the specified offset index.

A negative index or an index beyond the end of the string will return an empty string.

Examples

Example Result Notes
charAt("hello",0); "h"
charAt("hello",-1); "" Invalid index
charAt("hello",20); "" Invalid index
charAt("Wow™",3); "™"