Click or drag to resize

StringConversionConvertToLengthEncoded Method (String, Int32, Boolean, Byte, Int32, Int32, StringConversionGetBytes)

Convert a string to an array of bytes where the first 'lengthSize' bytes contain the string length.

Namespace:  Demo3D.PLC
Assembly:  PLC (in PLC.dll) Version: 15.0.2.11458
Syntax
C#
public static int ConvertToLengthEncoded(
	string str,
	int lengthSize,
	bool bigEndian,
	byte[] bytes,
	int index,
	int numBytes,
	StringConversionGetBytes encoding
)

Parameters

str
Type: SystemString
String to convert.
lengthSize
Type: SystemInt32
Number of bytes at the start of the byte array that encode the length of the string.
bigEndian
Type: SystemBoolean
Encoding for 'length'.
bytes
Type: SystemByte
Byte array to encode string into.
index
Type: SystemInt32
Index into byte array of first encoded byte (first byte of 'length').
numBytes
Type: SystemInt32
Maximum number of bytes in 'bytes' to encode string into.
encoding
Type: Demo3D.PLCStringConversionGetBytes
String converter.

Return Value

Type: Int32
Number of bytes encoded.
See Also