Results 1 to 2 of 2

Thread: Getting first two chars of bulk text

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2005
    Posts
    107

    Getting first two chars of bulk text

    Hey,

    I'm looking for a way to convert big amounts of hex and format them into Chr$("&H00") for example.

    I have no idea how to achieve this... I'm guessing that I would need to loop through the entire text, extracting the first two characters, adding the Chr$("&H"" & extractedbit & """)"". I also need it to ignore spaces. I hope this makes sense.

    For example say I have this: 3a ec 20 00

    I want it to change to this: Chr$("&H3a") & Chr$("&Hec") & Chr$("&H20") & Chr$("&H00").

    I'm also using Gambas.

    Thanks for any help, sorry if that sounds confusing.

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Getting first two chars of bulk text

    Basically:

    For i = 1 To Len(text) Step 3
    Output Chr$(", the character at i, the character at i+1, ), space, & and space
    Next i

    The exact syntax depends on the type of Basic.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width