UnicodeEncoding: 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. This can be either an Integer array or a String.
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.

See Also

Project CorLib Overview

Class UnicodeEncoding Overview