length Method

Class: byteString

Description

This method returns a right justified form of its source that consists of at least the specified number of bytes.

Syntax

ByteStringObject.length(ByteString delimiter)

Parameters

delimiter

The delimiter used to count subfields. Like the object instance, this is a ByteString as well.

Returns

The number of bytes in the byte string

When Became Available

Profile V7.0

Example

type String     STR = "Knäckebröd" // contains 2 two-byte characters

type ByteString BST = STR.toByteString() // the string as byte string

 

type Number LEN1 = BST.length() // LEN1 = 12

 

// (almost) NEVER the same as the previous example

type Number LEN2 = BST.length("") // LEN2 = 0 (zero)

 

// number of two-byte characters + 1 in this byte string=

type Number LEN3 = BST.length( 195.byte()) // LEN3 = 3