Article View: comp.lang.pascal.borland
Article #397Re: function StringOf
From: Quality
Date: Sun, 27 Dec 1998 00:00
Date: Sun, 27 Dec 1998 00:00
51 lines
2856 bytes
2856 bytes
Mike:
I've been programming high-level languages for over 25 years. I appreciate
the beginner help anyways. You should know however that there is very little
a programmer cannot do if they are willing to get their hands dirty and get
into the nitty gritty of the machine. Also, building a string in the manner
you describe does not allow for the "tabbing" function built into writeln
aVariableAnyType:8 ).
What I do NOT know much about is PC/ASM coding (my experience is mostly
mainframe). Maybe if someone knows how the compiler does this complex
(variable-multiple) parameter stuff it could be adapted into an external
unit or even maybe somehow the code could be "borrowed" or "piggy-backed"
from the compiler via a reverse-patch or proc-ptr ? Anybody know how to do
this in TP7 ?
If I create a new texfile, writeln a complex parameter as a line to that
file, then reset and readln back that data as a string I can accomplish what
I want. What I would like is a way to do this as a single function without
accessing the disk. Barring the single function, what about a simple routine
to create a small "virtual file" in RAM big enough to handle a string
variable?
Mike Copeland wrote in message ...
> First, you, the programmer, cannot create Pascal subprograms with
>variable numbers of parameters - only the compiler maker can do such
>things. However, if you're looking to "construct" a string of substrings
>(such as your example shows), you can use the Concat function or the "+"
>operator. For example:
>
>Var S1,S2 : string;
>...
> S2 := 'This is a substring.');
> S1 := 'Hello, '+'World! '+S2
>
>> In another Pascal there was a function that I would like to recreate:
>>
>> function StringOf ( ** SPECIAL ** ) : string;
>>
>> The SPECIAL part was a parameter that was virtually identical to the
>> parameter used by writeln(). That is to say that the following worked:
>>
>> TheCostStr := stringof ('Cost of item ' , ItemNameStr , ' = ' ,
>> Price[ItemNumber] * Qty[ItemNumber] ) , '.');
>>
>> Any idea how to create a function that would allow such a parameter ?
>>
Technical Details
Message-ID:
<765j75$mg7@enews4.newsguy.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<763sl2$v0@enews2.newsguy.com> <MPG.10ef42a8411e60b5989ad6@news.primenet.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111659,f9d88b35457e1f1d X-Google-Attributes: gid111659,public X-Google-Thread: 10261c,f9d88b35457e1f1d X-Google-Attributes: gid10261c,public X-Google-Thread: 108ebd,f9d88b35457e1f1d X-Google-Attributes: gid108ebd,public From: "Quality" <quality@annex.com> Subject: Re: function StringOf Date: 1998/12/27 Message-ID: <765j75$mg7@enews4.newsguy.com> X-Deja-AN: 426181648 References: <763sl2$v0@enews2.newsguy.com> <MPG.10ef42a8411e60b5989ad6@news.primenet.com> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0 Organization: http://extra.newsguy.com Newsgroups: comp.lang.pascal.borland,borland.public.turbopascal,comp.lang.pascal.misc