'"ascii ubyte.bas" 'String/uByte Conversion for FreeBASIC 'Copyright 2024 03/14 Tim Keal alias jargon Const NULL As Any Ptr = 0 #Define EQU = #Define GTR > #Define LSS < #Define NEQ <> #Define GEQ >= #Define LEQ <= Const EMPTY = "" declare sub ascii2array(byval text as string=EMPTY, array(any) as ubyte ) declare sub array2ascii(byref text as string=EMPTY, array(any) as ubyte ) sub ascii2array(byval text as string=EMPTY, array(any) as ubyte ) erase array dim as longint offset=0,index=0 do if offset GEQ len(text) then exit do redim preserve array(LBound(array,1) to UBound(array,1)) array(offset)=asc(mid(text,offset+1,1)) offset+=1 loop end sub sub array2ascii(byref text as string=EMPTY, array(any) as ubyte ) text = EMPTY dim as longint offset=0,index=0 offset = LBound(array,1) do if offset GTR UBound(array,1) then exit do text &= chr(array(offset)) offset+=1 loop end sub