Good morning
How I can Convert in my example each Charakter of the String to its Byte value?
Dim strsrc As String
strsrc = "Hello, Animal World!"
Dim byteArray() As Byte at strptr(strsrc)
dim i,v as integer
print str(byteArray[8]) ": " chr(byteArray[8]) '65 A
'How I can Convert each character of the string to its corresponding byte value
Hi Frank,
Using a DO loop to iterate over the string:
uses console
Dim strsrc As String
strsrc = "Hello, Animal World!"
Dim byteArray() As Byte at strptr(strsrc)
dim i,v as integer
'print str(byteArray[8]) ": " chr(byteArray[8]) '65 A
do
i++
if byteArray[i]=0
exit do
endif
print str(byteArray[i]) ":" tab chr(byteArray[i]) cr
loop
wait
Many thanks Charles :)
How I can make a String Buffer list with IT? Left two columns?
'uses corewin
'----- 1) ok
'
Dim strsrc As String
strsrc = "Hello, Animal World!"
Dim byteArray() As Byte at strptr(strsrc)
dim i,v as integer
do
i++
if byteArray[i]=0 then
'exit
end if
'print str(byteArray[8]) ": " chr(byteArray[8]) '65 A
print str(byteArray[i]) ": " + chr(byteArray[i])
loop until i=20
'----- 2) how to make a buffer string list with this array?
'
dim i,j as long
dim s,t as string
j=1
s=space 500
for i=1 to 20
t=str(i) chr(9) chr(i+64) chr(13) chr(10)
mid (s,j)=t
j+=len t
next
print left s,j-1
I have the solution :)
'
'nearly 99% good
'
Dim strsrc As String
strsrc = "Hello, Animal World!"
Dim byteArray() As Byte at strptr(strsrc)
dim i,j as long
dim s,t as string
j=1
s=space 600
for i=1 to 20
't=str(i) chr(9)+chr(i+64) +chr(13) +chr(10)+str(byteArray[i]) ": " + chr(byteArray[i])
't=chr(9)+chr(i+64) +chr(13)+chr(10)+str(byteArray[i]) ": " + chr(byteArray[i])
t=chr(9)+str(byteArray[i]) ": " + chr(byteArray[i])
mid (s,j)=t
j+=len t
next
print left s,j
2) Same example runs with ubound()
Dim strsrc As String
strsrc = "Hello, Animal World!"
Dim byteArray() as byte at strptr(strsrc)
'-----> go 2) with ubound() ------------- //
'
dim i,j,k as long
k=ubound(byteArray)*20
dim s,t,st as string
j=1
s=space 500
for i=1 to k 'ubound(byteArray) '20
't=str(i) chr(9)+chr(i+64) +chr(13) +chr(10)+str(byteArray[i]) ": " + chr(byteArray[i])
't=chr(9)+chr(i+64) +chr(13)+chr(10)+str(byteArray[i]) ": " + chr(byteArray[i])
t=chr(9)+str(byteArray[i]) ": " + chr(byteArray[i])
mid (s,j)=t
j+=len t
next
print left s,str(j-1)
I Like oxygen :) nice Weekend