Conversion Functions

Asc

Returns the NUMBER code that represents the specific character.

Syntax

  • Asc( string )

Arguments

  • string
    • The specified character to retrieve the NUMBER code for. If more than one character is entered, the function will return the value for the first character and ignore all of the characters after the first.

Base64DecodeText

Decocdes a textual value encoded in Base64 form.

This function is often used in webservice type integrations, where a Base64 encoded value is returned from a service.

Syntax

  • Base64DecodeText( value )

Arguments

  • value
    • The Base64 encoded value.

Base64EncodeBinary

Base64 encode a binary value such as an image (png, jpg, gif) or document (pdf).

This function is often used in webservice type integrations, where a Base64 encoded value is required to post to a service.

This function should often be used with the WebserviceGetBinary Function function to encode the result to a usable format.

Syntax

  • Base64EncodeBinary( value )

Arguments

  • value
    • The binary value.

Base64EncodeFile

Base64 encodes the contents of a file.

This function is often used in webservice type integrations, where a Base64 encoded value is required to post to a service.

This function can be used to upload images to a webservice, assuming it requires a Base64 encoded representation of the image (such as the Shopify Product Image upload).

Syntax

  • Base64EncodeFile ( file [, throwonerror])

Arguments

  • file
    • The path to the file.
  • throwonerror
    • Optional. When set to False the function will return an empty string instead of raising an error when an error occurs either opening or reading the file.

Base64EncodeText

Base64 encodes a textual value.

This function is often used in webservice type integrations, where a Base64 encoded value is required to post to a service.

Syntax

  • Base64EncodeBinary( value )

Arguments

  • value
    • The textual value.

CBool

Converts a value to a boolean.

Syntax

  • CBool( expression )

Arguments

  • expression
    • Any valid expression. If expression is zero, False is returned; otherwise, True is returned. If expression can't be interpreted as a numeric value, a run-time error occurs.

CByte

converts a value to a byte. (ie: number between 0 and 255).

Use the CByte function to provide conversiMadCap:xrefns from any data type to a Byte subtype. For example, CByte forces byte arithmetic when currency, single-precision, double-precision, or integer arithmetic would normally occur.

The CByte function uses the locale setting of your system to determine how to perform conversions. Different decimal separators are properly recognized depending on the locale setting, as are different thousand separators.

Syntax

  • CByte( expression )

Arguments

  • expression
    • Any valid expression. If expression lies outside the acceptable range for the byte subtype, an error occurs.

CCur

Use the CCur function to provide conversions from any data type to a Currency subtype. For example, CCur forces currency arithmetic when integer arithmetic would normally occur.

The CCur function uses the locale setting of your system to determine how to perform conversions. Different decimal separators are properly recognized, depending on the locale setting, as are different thousand separators.

Description

Returns an expression that has been converted to a Variant of subtype Currency.

Syntax

  • CCur( expression )

Arguments

  • expression
    • Any valid expression.

CDate

Use the IsDate function to determine if date can be converted to a date or time. CDate recognizes date literals and time literals as well as some numbers that fall within the range of acceptable dates. When converting a number to a date, the whole number portion is converted to a date. Any fractional part of the number is converted to a time of day, starting at midnight.

CDate recognizes date formats according to the locale setting of your system. The correct order of day, month, and year may not be determined if it is provided in a format other than one of the recognized date settings. In addition, a long date format is not recognized if it also contains the day-of-the-week string.

Description

Returns an expression that has been converted to a Variant of subtype Date.

Syntax

  • CDate( date )

Arguments

  • date
    • Any valid date expression.

CDbl

Use the CDbl function to provide conversions from any data type to a Double subtype. For example, CDbl forces double-precision arithmetic when currency or integer arithmetic would normally occur.

The CDbl function uses the locale setting of your system to determine how to perform conversions. Different decimal separators are properly recognized depending on the locale setting, as are different thousand separators.

Description

Returns an expression that has been converted to a Variant of subtype Double.

Syntax

  • CDbl( expression )

Arguments

  • expression
    • Any valid expression.

Chr

Description

Returns the character based on the number code.

Syntax

  • Chr( number_code )

Arguments

  • number_code
    • The NUMBER used to retrieve the character.

ChrW

Description

Returns the unicode character based on the number code.

Some Unicode characters can be difficult represent, enter or are non-visible. This function allows you to represent (or return) any Unicode character through its decimal value.

Syntax

  • ChrW( number_code )

Arguments

  • number_code
    • The Unicode decimal NUMBER used to retrieve the character.

Example

ChrW(2032)

' Returns the Unicode Prime (′) character.

ChrW(8206)

' Returns the non-printable Unicode Left-To-Right Mark.

ChrW(39277)

' Returns the chinese symbol 饭.

CInt

Use the CInt function to provide conversions from any other data type to an Integer subtype. For example, CInt forces integer arithmetic when currency, single-precision, or double-precision arithmetic would normally occur.

The CInt function uses the locale setting of your system to determine how to perform conversions. Different decimal separators are properly recognized depending on the locale setting, as are different thousand separators.

If expression lies outside the acceptable range for the Integer subtype, an error occurs.

Description

Returns an expression that has been converted to a Variant of subtype Integer.

Syntax

  • CInt( expression )

Arguments

  • expression
    • Any valid expression.

CLng

Use the CLng function to provide conversions from any data type to a Long subtype. For example, CLng forces integer arithmetic when currency, single-precision, or double-precision arithmetic would normally occur.

The CLng function uses the locale setting of your system to determine how to perform conversions. Different decimal separators are properly recognized depending on the locale setting, as are different thousand separators.

If expression lies outside the acceptable range for the Long subtype, an error occurs.

Description

Returns an expression that has been converted to a Variant of subtype Long.

Syntax

  • CLng( expression )

Arguments

  • expression
    • Any valid expression.

CSng

Use the CSng function to provide conversions from any data type to a Single subtype. For example, CSng forces single-precision arithmetic when currency or integer arithmetic would normally occur.

The CSng function uses the locale setting of your system to determine how to perform conversions. Different decimal separators are properly recognized depending on the locale setting, as are different thousand separators.

If expression lies outside the acceptable range for the Single subtype, an error occurs.

Description

Returns an expression that has been converted to a Variant of subtype Single.

Syntax

  • CSng( expression )

Arguments

  • expression
    • Any valid expression.

CStr

Use the CStr function to provide conversions from any data type to a String subtype. CStr forces the results to be expressed as a String.

The CStr function uses the locale setting of your system to determine how to perform conversions. Different decimal separators are properly recognized, depending on the locale setting.

The data in expression determines what is returned according to the following expressions:

Description

Returns an expression that has been converted to a Variant of subtype String.

  • Boolean
    • A String containing True or False.
  • Date
    • A String containing a date in the short-date format of your system.
  • Null
    • A run-time error.
  • Empty
    • A zero-length String ("").
  • Error
    • A String containing the word Error followed by the error number.
  • Other numeric
    • A String containing the number.

Syntax

  • CStr( expression )

Arguments

  • expression
    • Any valid expression.

Hex

Description

Returns a string representing the hexadecimal value of a number.

Syntax

  • Hex(number)

Arguments

  • number
    • Any valid expression. If number is not a whole number, it is rounded to the nearest whole number before the number is evaluated.

IsNumeric

Description

Returns a Boolean value indicating whether an expression can be evaluated as a number.

Syntax

  • IsNumeric(expression)

Arguments

  • expression
    • Any valid expression.

Oct

Description

Returns a string representing the octal value of a number.

Syntax

  • Oct(number)

Arguments

  • number
    • Any valid expression. If number is not already a whole number, it is rounded to the nearest whole number before being evaluated.