Function String Lists Class

StringSegmentXOfLengthY

"Nth Sub-string Of Length Y" or "Nth String Segment Of Length Y" Return the segment number vSegmentNumber of a string that is segmented into sub-strings of length Y.

Signature (Visual Basic / VBA)

Public Function StringSegmentXOfLengthY( _
      ByVal vValue As Variant _
    , ByVal vSegmentNumber As Variant _
    , ByVal vLength As Variant _
    ) As Variant

Code Example

    StringSegmentXOfLengthY("123 456 789 ", 2, 4) = "456 "
    StringSegmentXOfLengthY("123 456 789 ", 3, 4) = "789 "

Parameters

Parameter Description
vValue String containing the equal-length segments of which one is to be returned. Function returns Null if vValue is Null or cannot be fixed up to a String.
vSegmentNumber Number of the sub-string segment of vValue that is to be returned. vSegmentNumber defaults to 1 (one) if it is Null or cannot be fixed up to a number. Function returns an empty string if the segment number is < 1 (less than one).
vLength The length of each sub-string segment within string vValue. vLength defaults to 1 (one) if it is Null or cannot be fixed up to a number. Function returns an empty string if the segment length is < 1 (less than one).