Home
Top.Mail.Ru Yandeks.Metrika
Forum: "Main";
Current archive: 2002.01.08;
Download: [xml.tar.bz2];

Down

HELP !!! Find similar branches


Alligator   (2001-12-17 11:46) [0]

function SelectChars (s: ShortString; a: Integer; b: Integer): ShortString;
was
i: Integer;
ts: ShortString;
tp: PChar;
begin
ts: = "";
StrPCopy (tp, s);
for i: = a to a + b do ts: = ts + tp [i];
Result: = ts;
end;

This function cannot digest very long sentences. It (Function) immediately at the sight of long sentences kills my prog.
How can I fix this ???
thanks in advance!!!



gek   (2001-12-17 11:51) [1]

Well, why use ShortString
use String



Alligator   (2001-12-17 12:26) [2]

With the String prog also dies, I clearly don’t try anything else, can there be another function or option how to rip out what you need from the text ???



McSimm   (2001-12-17 12:38) [3]

1. Memory for PChar is not allocated.
2. Why is PChar here at all?
3. Why bother with this feature at all? If it is copying a substring, then
function Copy (S; Index, Count: Integer): string;



Alligator   (2001-12-17 12:57) [4]

Ah ... you misunderstood me!



gek   (2001-12-17 13:01) [5]

And what did they not understand? Why all this business is necessary, explain?



Alligator   (2001-12-17 13:34) [6]

Well, let's say I have a piece of long text and I need to check or paste only the first two letters.
-memo1.lines.add (SelectChars ("long text chunk", 0,1))
Ie, as you understand it, only two letters should be entered in the memo, starting with 0 and ending with 1, and this function works fine, but not with a long text, the limit is somewhere in the 255 characters, but what I do is limit.



Digitman   (2001-12-17 13:37) [7]

memo1.lines.add (Copy ("a piece of long text", 1,1)) - well, what's so uncomfortable with you? doing what you need, and without any additional "frills"



Mbo   (2001-12-17 13:41) [8]


about the Copy function already said.
and in your, besides 5 specified errors, return shortstring is described,
and Result - PChar



Alligator   (2001-12-17 18:38) [9]

THANK YOU VERY MUCH THANKS FOR HELP !!! Now everything works as it should.



Pages: 1 whole branch

Forum: "Main";
Current archive: 2002.01.08;
Download: [xml.tar.bz2];

Top









Memory: 0.58 MB
Time: 0.028 c
3-21957
KMM
2001-11-29 15:31
2002.01.08
In the course of the program, it is necessary to create and delete a table many times ...


1-22033
voronkov
2001-12-18 12:27
2002.01.08
How to make TEdit not generate a beep when the keystroke handler is on.


14-22388
Merlin
2001-11-08 11:43
2002.01.08
Another dirt in the pantry


1-22076
Snake
2001-12-19 12:50
2002.01.08
How to find out the release date of the BIOS?


3-21905
nic406
2001-11-28 04:21
2002.01.08
Help! I do Select * From T1 -> refresh -> error (ADODataSet)





afrikaans albanian Arabic armenian azerbaijani basque belarusian bulgarian catalan Chinese (Simplified) Chinese (Traditional) croatian Czech danish Dutch English estonian filipino finnish French
galician georgian German greek haitian Creole hebrew Hindi hungarian icelandic indonesian Irish italian Japanese Korean latvian lithuanian macedonian malay maltese norwegian
persian polish portuguese Romanian russian serbian slovak Slovenian Español swahili Swedish thai turkish Ukrainian urdu vietnamese welsh yiddish bengali bosnian
cebuano Esperanto gujarati hausa hmong igbo javanese kannada khmer lao latin maori marathi mongolian nepali punjabi somali tamil telugu yoruba
zulu
English French German Italian Portuguese Russian Spanish