UTF32Encoding: GetBytesEx

GetBytesEx

Encodes a set of characters into an array of bytes, returning the number of bytes produced.



 Public Function GetBytesEx(
	  ByRef Chars As Variant,
	  ByVal CharIndex As Long,
	  ByVal CharCount As Long,
	  ByRef Bytes ( ) As Byte,
	  ByVal ByteIndex As Long ) As Long

Parameters

Chars
[ByRef] Variant. the set of characters to be encoded into bytes.
CharIndex
[ByVal] Long. The index of the first character to begin encoding from.
CharCount
[ByVal] Long. The number of characters to be encoded.
Bytes
[ByRef] Byte. The destination for the encoded characters.
ByteIndex
[ByVal] Long. The index of the first byte stored in the destination array.

Return Values

Long -  The number of bytes produce by the encoding.

Remarks

The Bytes array cannot be null and must be large enough to hold the encoded set of characters. To obtain the size required, use GetByteCount to find the necessary size. Or, use GetMaxByteCount to get the largest size that could be produced. The largest size is not the perfect size, only the maximum number of bytes that could ever be produced by a number of characters. Resizing of the resultant Bytes array may be necessary.

The Chars parameter will accept either a String or an Integer array.

If Chars is a string then the CharIndex parameter is zero-based.

See Also

Project CorLib Overview

Class UTF32Encoding Overview

Encoding