TIP: Click on subject to list as thread! ANSI
echo: z3_pascal
to: Doug Brendish
from: Bob Lawrence
date: 1996-07-16 12:40:28
subject: Function Move

NK> I am curently writing a program which speed is of the ut-most
 NK> importance. But apart from that I need to be able to access
 NK> each char of a string at a time efficently. At the moment I am
 NK> using a array of char but I still have processes which only a
 NK> string can handle. As you know strings and arrays are not
 NK> compatable. One way but not both.

  The way I got around this was to use null-terminated strings and
pointers, which is about three-times as fast as manipulating Pascal
strings. If you use a zero-based array (zstr: array[0..255] of char;)
this is compatible with a Pchar pointer and you can use the Strings
Unit in BP7 to do your manipulation - then convert the final array
quickly to a Pascal string with StrPas().

  The basic idea is to allocate your data array into memory, and then
run the pointer along the array to pick out and manipulate the parts
you want, without having to duplicate it unnecessarily.

Regards,
Bob
  
___ Blue Wave/QWK v2.12
@EOT:

---
* Origin: Precision Nonsense, Sydney (3:711/934.12)
SEEN-BY: 633/267 270
@PATH: 711/934 808 50/99 635/544 727 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.