Core Function Ascii

From Sputnik Wiki
Jump to: navigation, search
Ascii( <expression> )

Contents

Description

Returns the String (In raw ASCII) representation of an expression

Parameters

Expression

An expression to convert.

Return Value

Success: Returns the string in raw ASCII mode.

Failure: Returns empty string.

Remarks

Normally for each character in a string 2 bytes are used (UTF8 is what Sputnik uses) so when you convert a string to ASCII if that second byte has data in it it will become part of the ASCII increasing its size... However this function ignores all additional Unicode bytes and simply returns the first set of bytes ignoring all extra Unicode bytes.

So you get a raw ASCII string that is the same size as the old string but with Unicode bytes removed.

Of course the new string is technically unique and contains the Unicode extra bytes just like the old one did but they are all 0x00 now.

Example

msgbox '猫'; // Prints 猫
msgbox (ASCII)'猫'; // Prints +
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox