Signature (Visual Basic / VBA)
Public Function ShuffleStringSegments( _
ByVal vString As Variant _
, ByVal vSegmentLength As Variant _
) As Variant
Code Examples
Rnd(-1) = 0.224007
ShuffleStringSegments("AZ CA NV OR WA ", 3) = "CA NV OR AZ WA "
ShuffleStringSegments("AZ CA NV OR WA ", 3) = "NV AZ CA WA OR "
ShuffleStringSegments("ABCDEF", 1)
ShuffleString("ABCDEF")
Parameters
| Parameter | Description |
|---|---|
| vString | String containing the equal-length segments which are to be randomly shuffled. Function returns Null if vString is Null or cannot be fixed up to a String. |
| vSegmentLength | The length of each sub-string segment within string vValue. vSegmentLength defaults to 1 (one) if it is Null or cannot be fixed up to a number. |
Notes & Version History
| Note | The call to the Visual Basic Rnd function in the above example seeds the Visual Basic random number generator so that the sample results can be reproduced. There is generally no need to call the Rnd function within your programs since Entisoft Tools initializes the Visual Basic random number generator once with "Randomize" statement. |
| Note | The following two statements are equivalent, though because randomness is involved, they will seldom be equal: |
| Note | Using a segment length of 1 (one) has the same effect as calling the ShuffleString function--individual characters are shuffled. Function returns Null if the segment length is < 1 (less than one). |