ASCII in JS

Description

This function returns the number code of a character on the ASCII table (JavaScript charCodeAt function Documentation).

Sample Source Pattern

Syntax

string.charCodeAt( [index] )

Arguments

index(Optional): Index of string to get character and return its code number on the ASCII table. If this parameter is not specified, it takes 0 as default.

Return Type

Int.

Examples

CREATE OR REPLACE FUNCTION get_ascii(c char)
  RETURNS string
  LANGUAGE JAVASCRIPT
AS
$$
  return C.charCodeAt();
$$;

SELECT GET_ASCII('A') A, GET_ASCII('a') a;

Last updated