StringByteLength - spectrum_spatial - Latest

Spectrum Spatial Guide

Product type
Software
Portfolio
Locate
Product family
Spectrum™ software
Product
Spectrum™ software > Spatial > Spectrum Spatial
Version
Latest
ft:locale
en-US
Product name
Spectrum Technology Platform
ft:title
Spectrum Spatial Guide
Copyright
2025
First publish date
2007
ft:lastEdition
2025-03-07
ft:lastPublication
2025-03-07T10:28:48.112000

Description

Returns the number of bytes in a string for a given charset. It is sometimes useful to know the number of bytes needed to represent a string with multi-byte character sets (for example: UTF-8 or WindowsJapanese). A string with UTF-8 charset can use up to 4 bytes to represent a character.

Syntax

StringByteLength ( str,charset )

Arguments

str is a string expression

charset is a string representing the charset (MapBasic or Java)

Both arguments are required.

Example

Returns 32 because the eight Japanese characters use four bytes each when using UTF-32.
select StringByteLength("滋賀県草津市草津", "UTF-32") 

Remarks

If a non-string value is passed for str or charset, an error is thrown.

If an invalid charset (including an empty string) is passed for charset, an error is thrown.