Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Trailing space
Wed, Apr 15 2009 9:14 PMPermanent Link

yury
Hi,
is there a workaround to prevet removing trailing spaces for char data type?

Thank you,
Yury
Thu, Apr 16 2009 12:26 AMPermanent Link

"Jerry Clancy"
Just pad right the result to the length of the field.

Some functions you might find useful:

function pad(sStr:string; nSize: integer): string;
var
 i: integer;
begin
 for i := 1 to nSize - length(sStr) do sStr := sStr + ' ';
 pad := sStr;
end;

function padl(S:string; nLen: integer): string;
begin
 while length(s) < nLen do S := ' ' + S;
 padl := S;
end;

function padl0(S:string; nLen: integer): string;
begin
 while length(s) < nLen do S := '0' + S;
 padl0 := S;
end;

function padr(sStr:string; nSize: integer): string;
begin
 Result := pad(sStr, nSize);
end;


Jerry

"yury" <yury@favour.com.au> wrote in message
news:4F52B06F-9999-4115-B9DB-7FE987BC79C9@news.elevatesoft.com...
> Hi,
> is there a workaround to prevet removing trailing spaces for char data
> type?
>
> Thank you,
> Yury
>
Fri, Apr 17 2009 11:39 AMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Yury,

DBISAM does not automatically remove trailing spaces from CHAR (FixedChar)
fields - blank spaces are only automatically trimmed from VARCHAR (String)
fields. So, the workaround is to use the CHAR type instead of VARCHAR.

--
Fernando Dias
[Team Elevate]
Image