Lasso Soft Inc. > Home

[ bytes->sub ]

Method

Returns a segment of the bytes. Requires an integer parameter as the position from which the segment begins. An optional second integer parameter defines the length of the bytes segment to return. The returned object contains the segment from the starting position and continues until the end of the bytes sequence, or up to the specified length of the bytes segment.

  • Syntax
Bytes Object->sub(Integer)
Bytes Object->sub(Integer,Integer)
Examples
  • Beginner

To return a segment of a bytes object:

Use the [bytes->sub] method. The following example returns a bytes segment starting from position 6 until the end of the bytes sequence.

Code

local(b = bytes('rhinoceros'))
#b->sub(6)

Result

ceros

To return a segment of a bytes object:

Use the [bytes->sub] method. The following example returns a bytes segment starting from position 6 of length 4.

Code

local(b = bytes('rhinoceros'))
#b->sub(6,4)

Result

cero

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft