Link to home
Start Free TrialLog in
Avatar of cmdolcet
cmdolcetFlag for United States of America

asked on

Convert a non printable ACSII char to a decimal value

THe routine below converts a string value of w to the ASCII equivalent of Dec 119, if i had a non printable character how could i convert it to a Dec?

For example the decimal value of 10
Public checksumchar As String = "w"
    Public Associatedchecksum(0) As String
 
 Private Sub Data_CheckSum()
        Dim myChars() As Char
        myChars = checksumchar.ToCharArray()
        Associatedchecksum(0) = AscW(myChars(0))
    End Sub

Open in new window

Avatar of Kevin Cross
Kevin Cross
Flag of United States of America image

Yes I believe that works in most cases.  I know the line feed (nl) character does or at least it did for me.
Public checksumchar As String = vbLf
    Public Associatedchecksum(0) As String
 
 Private Sub Data_CheckSum()
        Dim myChars() As Char
        myChars = checksumchar.ToCharArray()
        Associatedchecksum(0) = AscW(myChars(0))
    End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Kevin Cross
Kevin Cross
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial