VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Generates a string of characters that fall between the two specified characters.

by VB-Kung-Fu (19 Submissions)
Category: String Manipulation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Thu 9th October 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Generates a string of characters that fall between the two specified characters.

Rate Generates a string of characters that fall between the two specified characters.



Dim n As Byte, FromCode As Byte, ToCode As Byte

'ensure we only extract one character from the strings
FromChar = Left(FromChar, 1): ToChar = Left(ToChar, 1)

'get the character codes for the characters
'(we use the codes for the 'For' loop range values)
FromCode = Asc(FromChar): ToCode = Asc(ToChar)

'swap the values if needed
If ToCode < FromCode Then
    n = ToCode
    ToCode = FromCode
    FromCode = n
End If

'generate the string
For n = FromCode To ToCode
    SequentialStr = SequentialStr & Chr(n)
Next n

End Function



Download this snippet    Add to My Saved Code

Generates a string of characters that fall between the two specified characters. Comments

No comments have been posted about Generates a string of characters that fall between the two specified characters.. Why not be the first to post a comment about Generates a string of characters that fall between the two specified characters..

Post your comment

Subject:
Message:
0/1000 characters