StringConversionConvertToLengthEncoded Method (String, Int32, Int32, Boolean) |
Convert a string to an array of bytes where the first 'lengthSize' bytes contain the string length.
Only works with 1 byte character encoded strings (eg ASCII).
Namespace:
Demo3D.PLC
Assembly:
PLC (in PLC.dll) Version: 15.0.2.11458
Syntaxpublic static byte[] ConvertToLengthEncoded(
string str,
int lengthSize,
int maxLength,
bool bigEndian
)
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. - maxLength
- Type: SystemInt32
Maximum length of the string to write. - bigEndian
- Type: SystemBoolean
Encoding for 'length'.
Return Value
Type:
ByteEncoded byte array.
See Also