Subject | Re: [firebird-support] string difficulty |
---|---|
Author | setysvar |
Post date | 2015-12-07T19:59:16Z |
Den 07.12.2015 13:55, skrev 'checkmail' check_mail@...
[firebird-support]:
Hence, I think your 16 lines above can be replaced by one simple line
(if you use Fb 2.5):
str = trim (trailing '*' from left(:str, 16));
HTH,
Set
[firebird-support]:
> .. and if the ID has the length of 15 chars and only the las * is forfilling out to 16, i get a wrong result too.
>http://www.firebirdsql.org/refdocs/langrefupd25-intfunc-trim.html
> Can I compact my code?
>
> if(char_length(str)>16) then
> begin
> str = left(:str,16);
> while (k = 1) do
> begin
> if(right(str, 1) = '*') then
> begin
> str = left(str,char_length(str)-1);
> end
> else
> begin
> teil = str;
> k = 0;
> end
> end
> end
>
> (exept the one begin-end (only one command can be without..)
>
Hence, I think your 16 lines above can be replaced by one simple line
(if you use Fb 2.5):
str = trim (trailing '*' from left(:str, 16));
HTH,
Set