Find a Character’s ASCII Value

Given one printable ASCII character character, return its integer ASCII code. A space is a valid character; preserve it exactly. Do not trim or change case.

Given one printable ASCII character `character`, return its integer ASCII code. A space is a valid character; preserve it exactly. Do not trim or change case.

The input is exactly one character with ASCII code 32 through 126 inclusive. Empty strings, multiple characters, control characters and non-ASCII input are excluded.

Example 1: input character = "A"; output 65. Uppercase A has ASCII code 65.

Example 2: input character = "a"; output 97. Lowercase a has a different ASCII code.

Example 3: input character = " "; output 32. The space is preserved and has code 32.

Category: Strings. Topic: strings. Difficulty: Easy. Patterns: string-processing.