char At

Get a character (letter, number, or symbol) from a place in the text string.

"this"0char fromat
JavaScript
(method) String.charAt(index: number): string;
Python
(method) String.char_at(index: number): str

You can find out which character is at any place in some text. You might have text thats says "Hello there!". The character at position 6 is 't'. The word “Hello” plus the space have positions 0 - 5, so, ‘t’ is at position 6. To get the character at this position, the letter 't', you could use a blocks like this:

"Hello there!"greeting6char fromatsetteetosetgreetingto

Parameters

  • index: the number for the position in the text string to return a character for.

Returns

  • a single character string that is from the selected position in the text string.

Example

Make a funny new sentence from an existing sentence by choosing every other letter.

"Cinnamon vanilla latte"isentencelength of1-i2remainder of/0‏>funnySentencesentenceichar fromatjoinsetfunnySentencetoifthenforfrom 0 todosetsentencetoon start

See also

char code at, substr