Link to home
Start Free TrialLog in
Avatar of IT79637
IT79637Flag for United States of America

asked on

How to get data from a char array to a string variable?

Hi Experts,
I'm using Delphi 7.

How do I get character data in an array to a string?  I'm using a For loop because I only want a subset of the data from the array.
The code below does not


Thanks much!

var
  Buffer : array [0..MAXFILESIZE] of char;
  OCRString : string;
 
for i := posBegin to posEnd do
    OCRString := OCRString + (Str[I]) ;
 
My string looks like this:
ABCD#/ABC|DEF|GHIJK\#l;f-3 094QWERalsefd
            
I want to extract pos 4 to 19 (start with first # and end with K before the \).
 
The output OCRString in debug mode looks like this: #0#$12#0#0#0#1#0#0#0#1#0#0#0'4'#0#0#0

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of MerijnB
MerijnB
Flag of Netherlands 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
Avatar of IT79637

ASKER

Works great.  All I had to do was adjust the start position and length to adjust for my starting and ending delimiters.

Thanks much.