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.57 MB
Time: 0.039 c
1:22241
Yuraz
2001-12-17 10:09
2002.01.08
FileListBox1.FileName returns the full path to the file, how to make it return only the file name?


3:21978
Anonymous worker
2001-12-04 20:25
2002.01.08
ADO + Excel + Delphi5


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


1:22103
ProfiUgl
2001-12-19 17:15
2002.01.08
Event form


6:22285
Vital
2001-10-09 12:34
2002.01.08
The problem of choice





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 Spanish 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