Board index » cppbuilder » Re: RichEdit and special letters...question

Re: RichEdit and special letters...question


2004-07-16 05:08:25 PM
cppbuilder71
Oren Halvani wrote:
Quote
if(!strLower.Pos(s[y])) {re->Lines->Delete(x); break;}
This is all about logic. What you can reed here is as much as:
If the character -s[y]- is not in strLower then delete the line.
But that is not what you want. What you want is:
If character is in strLower then keep the line.
Hans.
 
 

Re:Re: RichEdit and special letters...question

"Hans Galema" < XXXX@XXXXX.COM >schrieb im Newsbeitrag
Quote
This is all about logic. What you can reed here is as much as:
If the character -s[y]- is not in strLower then delete the line.
But that is not what you want. What you want is:
If character is in strLower then keep the line.
Hans.
so it's wrong to negate in that way if(!strLower.Pos.... ??
OK, so what do i need to check ?? can you explain me that..?
Oren
 

Re:Re: RichEdit and special letters...question

Oren Halvani wrote:
Quote
so it's wrong to negate in that way if(!strLower.Pos.... ??
Yes, as you already found out yourself.
Quote
OK, so what do i need to check ?? can you explain me that..?
I already told you:
"If character is in strLower then keep the line."
Hans.
 

{smallsort}

Re:Re: RichEdit and special letters...question

"Hans Galema" < XXXX@XXXXX.COM >schrieb im Newsbeitrag
Quote
Oren Halvani wrote:
>OK, so what do i need to check ?? can you explain me that..?

I already told you:

"If character is in strLower then keep the line."

Hans.
that helps me very much Hans :-( can you be a little bit more specific..?
what do i need to check exactly in strLower..?
Oren
 

Re:Re: RichEdit and special letters...question

Oren Halvani wrote:
Quote
that helps me very much Hans :-( can you be a little bit more specific..?
what do i need to check exactly in strLower..?
That you were told: "If character is in strLower". I also already
showed you how you can check if a given character is in strLower.
Check if the character's that you take one by one from the line are
in strLower, then at the first character that satisfies, decide
that you keep the line and break.
You see: I'm not going to code that for you. You should be able to do
that yourself now. If not then compare -again- with the full code you
have already for deleting a line if a character is in strUpper.
Hans.
 

Re:Re: RichEdit and special letters...question

"Hans Galema" < XXXX@XXXXX.COM >schrieb im Newsbeitrag
Quote
Check if the character's that you take one by one from the line are
in strLower, then at the first character that satisfies, decide
that you keep the line and break.

You see: I'm not going to code that for you. You should be able to do
that yourself now. If not then compare -again- with the full code you
have already for deleting a line if a character is in strUpper.

Hans.
Hans, i also don't want you to code that for me..i wish i could solve it by
myself
but i don't understand what i'm doing wrong..please take a look:
what about this:
for(int x = re->Lines->Count - 1; x>= 0; --x)
{
AnsiString s = re->Lines->Strings[x];
int Length = s.Length();
for(int y = 1; y <= Length; ++y)
{
if(re->Lines->Strings[x].LastDelimiter(strLower) != s[y])
re->Lines->Delete(x); break;
}
}
or this:
for(int x = re->Lines->Count - 1; x>= 0; --x)
{
AnsiString s = re->Lines->Strings[x];
int Length = s.Length();
for(int y = 1; y <= Length; ++y)
{
if(! (s[y] == re->Lines->Strings[x].LastDelimiter(strLower)) )
re->Lines->Delete(x); break;
}
}
what is wrong....??? i realy don't understand..i check the current letter s[y]
in the line[x]
IF it's NOT inside strLower than DELETE the line[x]...why isn't it working..?
please tell me what is wrong here..??
Oren
 

Re:Re: RichEdit and special letters...question

Oren Halvani wrote:
Quote
"Hans Galema" < XXXX@XXXXX.COM >schrieb im Newsbeitrag
news:40f7c1c7$ XXXX@XXXXX.COM ...

>Check if the character's that you take one by one from the line are
>in strLower, then at the first character that satisfies, decide
>that you keep the line and break.
Hans, i also don't want you to code that for me..i wish i could solve it by
myself
but i don't understand what i'm doing wrong..please take a look:

if(re->Lines->Strings[x].LastDelimiter(strLower) != s[y])
re->Lines->Delete(x); break;
Why are you using LastDelimiter() ? Please start reading the help
for LastDelimiter() for what is does. For the rest: I showed you
how to use Pos() to see if a given character is in a string. So
again: what makes you use LastDelimiter() ? And also: why don't you
use Pos() ? And read the help for Pos() to please.
Hans.
 

Re:Re: RichEdit and special letters...question

Quote
Why are you using LastDelimiter() ? Please start reading the help
for LastDelimiter() for what is does. For the rest: I showed you
how to use Pos() to see if a given character is in a string. So
again: what makes you use LastDelimiter() ? And also: why don't you
use Pos() ? And read the help for Pos() to please.

Hans.
OK..here's Pos() again...
if(strLower.Pos(s[y]) == 0) re->Lines->Delete(x); break;
i think this is OK now..it delets the unwanted lines and leaves lines that
contains
lowercase letters..or do you have another suggestion..?
Oren
 

Re:Re: RichEdit and special letters...question

Oren Halvani wrote:
Quote
if(strLower.Pos(s[y]) == 0) re->Lines->Delete(x); break;

i think this is OK now..it delets the unwanted lines and leaves lines that
contains
lowercase letters..or do you have another suggestion..?
What you have now reads as:
if character -s[y]- is not in strLower then delete the line
That is not the same as what you wanted. You wanted:
"If character is in strLower then keep the line."
So how could your implementation do what you wanted ?
Hans.