Home > Posts > Hex8$ – pad a hex string’s start with 0’s in Visual Basic

Hex8$ – pad a hex string’s start with 0’s in Visual Basic

Private Function Hex8$(x As Long)
Dim s As String
Dim l As Integer
s = Hex$(x)
l = Len(s) ‘this will be 8 hex digits maximum cause x is a long
If (t < 8) Then s = String$(8 – l, "0") & s
Hex8$ = s
End Function

Advertisements
Categories: Posts
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: