Board index » cppbuilder » complicated string copy (cloning) operation in Memo->Text...

complicated string copy (cloning) operation in Memo->Text...


2003-12-19 09:08:38 AM
cppbuilder41
hi dear builders,
I got a problem to copy a string (includes CRLF's) several times
after the string ends..I better show you a sample:
this is what I mean:
----
| |
| |
| |
| |
----
this is what I need:
---- ---- ---- ----
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
---- ---- ---- ----
how can this be handled ?? I looked on the net (google) to
see if someone else ever asked this before, but no results :-(
can someone help..?
Thanks for any help...
Oren
 
 

Re:complicated string copy (cloning) operation in Memo->Text...

"Oren (Halvani.de)" < XXXX@XXXXX.COM >wrote in message
Quote
this is what I mean:
<snip>
this is what I need:
Any particular reason why you are using a Memo for that in the first place?
Why text and not images?
Gambit
 

Re:complicated string copy (cloning) operation in Memo->Text...

"Oren \(Halvani.de\)" < XXXX@XXXXX.COM >wrote:
Quote
I got a problem to copy a string (includes CRLF's) several
times after the string ends..I better show you a sample:
[snip]
Let's see, if I understand your problem. You have a string like
this:
" ---- \n| | \n| | \n..."
and you want to multiply every substring that ends with '\n'.
Correct? Use the TStringList's Text property for that:
TStringList* MyStringList = new TStringList;
MyStringList->Text = MyString;
for(int line = 0; line < MyStringList->Count; ++line)
{
MyStringList->Strings[line] = MyStringList->Strings[line]
+ MyStringList->Strings[line]
+ MyStringList->Strings[line]
+ MyStringList->Strings[line];
}
MyString = MyStringList->Text;
delete MyStringList;
If you have DupeString available (in StrUtils.hpp) you can use
that instead to multiply your strings:
for(int line = 0; line < MyStringList->Count; ++line)
MyStringList->Strings[line] = DupeString(MyStringList->Strings[line], 4);
 

{smallsort}