"Sputnik" help  
Sputnik Help
Char(<value>)

Description

The Char function is used to explicitly convert a value to a character type. If the provided value is already a character, it is returned without modification. If the value is a string, it returns the first character. If the conversion is not feasible within the scope of this function, it returns the null character.

Parameters

<value> The value to be converted to a character.

Return Value

Success: Returns the character representation of the specified value.
Failure: Returns the null character (0 or \0) if the value cannot be converted to a character within the scope of this function.

Remarks

The Char function is used to explicitly convert a value to a character type. If the provided value is already a character, it is returned without modification. If the conversion is not feasible within the scope of this function, it returns the null character.

In Sputnik, a Char is represented as an unsigned 16-bit integer. It's important to note that characters exceeding the maximum possible value may utilize surrogates.

Related

Casting, IsVarChar

Example

Example of usage:

my $result = Char(65);
say $result;
// PRINTS
// A

my $charValue = Char("Z");
say $charValue;
// PRINTS
// Z

my $stringChar = Char("Hello");
say $stringChar;
// PRINTS
// H

Casting:

my $result = (Char)65;
say $result;
// PRINTS
// A

 


Contact
Cheryl (uberfox@hotmail.com)
Homepage
http://ubersoft.org