HELP 
Author Message
 HELP

Is there anyway I can convert a string into chars????


Tue, 05 Aug 2003 17:15:35 GMT  
 HELP
const  max = 256; (* maximum string length to convert *)

type  CharArray = Array[1..max] of char;

var  chars: CharArray;

function StringToChars(inStr: string):charArray;
var  loop: integer;
begin
  for loop:=1 to length(inStr) do
    chars[loop]:=inStr[loop];
  StringToChars:=chars;
end;

begin
  chars:=StringToChars('Hello');
end.

The above program can be used to convert a string to an array of chars.
But I don't know why you want to do this as you can refer to a particular
character in a string by the following:-

if   tStr:='Hello'

therefor   tStr[1] = 'H'
                tStr[2] = 'e'
                tStr[3] = 'l'
                tStr[4] = 'l'
                tStr[5] = 'o'

I hope this is of some help.



Tue, 05 Aug 2003 18:24:02 GMT  
 HELP

Quote:
> Is there anyway I can convert a string into chars????

A string is an array of chars.
type string = array[0..255] of char is standard defined in most Pascals, and
type string[n] = array[0..n] of char too (OK, you can't define things like
that in Pascal, but I guess you know what I mean), where n determines the
memory allocation and equals the maximum string length.
So you can use MyString[MyOffset] to refer to one of the chars making up the
string. MySring[0] refers to the length of the string by the way.

KuifWare
http://kuifware.freeservers.com



Tue, 05 Aug 2003 19:53:01 GMT  
 HELP


Quote:
> Is there anyway I can convert a string into chars????

Thanks for your help. My program actually works now.


Tue, 05 Aug 2003 21:43:31 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP............

2. Lousy Palette - help, help, help, help, help...

3. HELP HELP HELP HELP!!!

4. HELP!!HELP!!HELP!!HELP!!

5. MDB without ODBC?? Help Help Help

6. help-help-help: convert paradox database to another

7. HELP HELP HELP!!!

8. help help help me!!!!

9. HELP.. HELP ...HELP

10. Help, Help, Help BCD

11. Help, Help, Help BCD

12. HELP HELP HELP!!!!

 

 
Powered by phpBB® Forum Software