Board index » delphi » Silly ol' ASCII table

Silly ol' ASCII table

I am trying to perform a Table1.SetRange() operation that is supposed to
contain the foreign word *K?so* (second character is Chr(255)) by having
the user type in *K* only.

I cant get it to work.

I have been using the following code:

var
   sStart,sFin: string;
begin
   sStart := Uppercase(Edit1.Text); {User enters 'K' in this Edit Box}
   sFin := sStart + Chr(255);
   Table1.SetRange([sStart],[sFin]);
end;

Can anyone offer assistance? Or has the ASCII table got me stumped.

TIA
jw

 

Re:Silly ol' ASCII table


I haven't tried your code but it seems to me that you are excluding 'K?so'
with the SetRange.
You use 'K?' as the range end, but that is less then 'K?so' I would say.
Since I haven't tested it, I could be wrong.

James Wong <one4r...@hotbot.com> skrev i en
nyhedsmeddelelse:01bee896$b66d2fe0$eb5541c0@mybox...

Quote
> I am trying to perform a Table1.SetRange() operation that is supposed to
> contain the foreign word *K?so* (second character is Chr(255)) by having
> the user type in *K* only.

> I cant get it to work.

> I have been using the following code:

> var
>    sStart,sFin: string;
> begin
>    sStart := Uppercase(Edit1.Text); {User enters 'K' in this Edit Box}
>    sFin := sStart + Chr(255);
>    Table1.SetRange([sStart],[sFin]);
> end;

> Can anyone offer assistance? Or has the ASCII table got me stumped.

> TIA
> jw

Re:Silly ol' ASCII table


Quote
"James Wong" <one4r...@hotbot.com> wrote:
>I am trying to perform a Table1.SetRange() operation that is supposed to
>contain the foreign word *K?so* (second character is Chr(255)) by having
>the user type in *K* only.

>I cant get it to work.

>I have been using the following code:

>var
>   sStart,sFin: string;
>begin
>   sStart := Uppercase(Edit1.Text); {User enters 'K' in this Edit Box}
>   sFin := sStart + Chr(255);
>   Table1.SetRange([sStart],[sFin]);
>end;

The string "K?so" is not inside the range "K", "K"+chr(255).  "K?so" sorts
after "K?".

I would probably try something like this:

  sStart := Uppercase(Edit1.Text);
  sFin := sStart;
  inc( sFin[length(sStart)] );
  Table1.SetRange( ... );

In this example, that sets the range to "K","L".
--
- Tim Roberts, t...@probo.com
  Providenza & Boekelheide, Inc.

Other Threads