Home > database >  The original concept help string data type conversion o char
The original concept help string data type conversion o char

Time:09-20

I am now doing a topic
Strings that will be inside the text boxes, hex, read to come in, and then press a to convert
010401000001 a string, for example, after transformation is expressed as

Data [1]='~ h01-2'
Data [2]='~ h04'
Data [3]='~ h01-2'
Data [4]='~ h00'
Data [5]='~ h00'
Data [6]='~ h01-2'

The data is defined as char data []

I did this
For I=1 to l/2
Data [I]='h ~ + mid (input, (2 * I) - 1, 2) (string input text box)
Next
But complains
Invalid hex character sequence in the string
I hope people
With 100 points, to, thank you

CodePudding user response:

Can use the following address:
http://download.csdn.net/detail/xiajinxian/3429501

Hexdecode (' FF ')//return characters

Or

Char (todec (' FF ', 16))//

Method of use: see http://blog.csdn.net/xiajinxian/article/details/6594589

CodePudding user response:

~ h is the key word, want to use escape characters
For I=1 to l/2
Data [I]='~ ~ h + mid (input, (2 * I) - 1, 2))
next

CodePudding user response:

refer to the second floor sjlion response:
~ h is the key word, want to use escape characters
For I=1 to l/2
Data [I]='~ ~ h + mid (input, (2 * I) - 1, 2))
Next


'~ h' on behalf of the opening is the hexadecimal, can't escape

CodePudding user response:

This is very technical

CodePudding user response:

String ls_string
String sdata []
Int I, l
Ls_string='010401000001'
L=Lena (ls_string)
For I=1 to l/2
Sdata [I]='~ ~ h + mid (ls_string, (2 * I) - 1, 2)
Messagebox (' sdata [I])
Next

I don't know if you want this
  • Related