Character Codepoint (Expression) — Skript

Addon: Skript · Category: Expression · Since: 2.9.0

Syntax

[the] [unicode|character] code([ ]point| position) of %strings%

Description

Returns the Unicode codepoint of a character

Examples

function is_in_order(letters: strings) :: boolean:
	loop {_letters::*}:
		set {_codepoint} to codepoint of lowercase loop-value

		return false if {_codepoint} is not set # 'loop-value is not a single character'

		if:
			{_previous-codepoint} is set
			# if the codepoint of the current character is not
			#  1 more than the codepoint of the previous character
			#  then the letters are not in order
			{_codepoint} - {_previous-codepoint} is not 1
		then:
			return false

		set {_previous-codepoint} to {_codepoint}
	return true

View source