468,504 Members | 2,001 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,504 developers. It's quick & easy.

How to extract text line by line from TMemo?

62
Hi everyone,

I need to check for a substring in each line of a TMemo, how can I get each line separately?
I'm using this method now:
Expand|Select|Wrap|Line Numbers
  1.  int found;
  2.         for (int i=1; i<MemoLines; i++)
  3.         {
  4.                 String str = ShoppingBasketMemo->Lines->GetText();
  5.                 found = str.Pos(ProductNameForSearch);
  6.                 if (found!=0)
  7.                         ShoppingBasketMemo->Lines->Delete(i);
  8.  
But it is giving me all lines together into str, i can't separate them out.
Can't also find any function to do that. Does anyone know this?
Dec 11 '07 #1
1 4742
Savage
1,764 Expert 1GB
Hi everyone,

I need to check for a substring in each line of a TMemo, how can I get each line separately?
I'm using this method now:
Expand|Select|Wrap|Line Numbers
  1.  int found;
  2.         for (int i=1; i<MemoLines; i++)
  3.         {
  4.                 String str = ShoppingBasketMemo->Lines->GetText();
  5.                 found = str.Pos(ProductNameForSearch);
  6.                 if (found!=0)
  7.                         ShoppingBasketMemo->Lines->Delete(i);
  8.  
But it is giving me all lines together into str, i can't separate them out.
Can't also find any function to do that. Does anyone know this?
This is C++ builder,right?
If so,I believe that Lines are array of AnsiStrings,which means that by specifying it's index you could get ith line from the control.

Savage
Dec 29 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by questioner | last post: by
9 posts views Thread by Sharon | last post: by
4 posts views Thread by Rafal 'Raf256' Maj | last post: by
8 posts views Thread by nick | last post: by
8 posts views Thread by Fabian Braennstroem | last post: by
9 posts views Thread by flit | last post: by
reply views Thread by napolpie | last post: by
5 posts views Thread by Steve | last post: by
3 posts views Thread by gieforce | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.