String.MiddleBytes
From Xojo Documentation
New in 2019r3
Supported for all project types and targets.
Returns a portion of a String. The first character is numbered 0.
Syntax
result=stringVariable.MiddleBytes(start [,length])
Part | Type | Description |
---|---|---|
result | String | The portion of source from start and continuing for length characters or all remaining characters if length is not specified. The encoding of result is the same as the source. |
start | Integer | Required. The position of the first byte to be returned.
If start is greater than the number of bytes in source, an empty string is returned. |
length | Integer | Optional. The number of bytes to return from source.
If omitted, all bytes from start to the end of source are returned. If length + start is greater than the length of source, all bytes from start to the end of source will be returned. |
stringVariable | String | Any variable of type String. |
Notes
MiddleBytes treats source as a series of bytes, rather than a series of characters. MiddleBytes should be used when source represents binary data. The encoding of the result is the same as the encoding of the source string.
If you need to extract characters rather than bytes, use the String.Middle function. To determine the number of bytes in a String, use the String.Bytes function.
Examples
These examples use the MiddleBytes function to return portions of a String.
See Also
AscB, ChrB, String.IndexOfBytes, String.LeftBytes, String.Bytes, String.Middle, String.RightBytes, MemoryBlock.MidB functions.