Hello,

 

but this ist almost realized in my code, isn't it?

 

>From right until there is no * present

 

 

Von: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] 
Gesendet: Montag, 7. Dezember 2015 23:28
An: firebird-support@yahoogroups.com
Betreff: RE: [firebird-support] string difficulty

 

  

How about working backwards through the string?

 

Andrew Zenz

 

  _____  

From: firebird-support@yahoogroups.com
<mailto:firebird-support@yahoogroups.com>
[mailto:firebird-support@yahoogroups.com] 
Sent: Tuesday, 8 December 2015 6:59 AM
To: firebird-support@yahoogroups.com
<mailto:firebird-support@yahoogroups.com> 
Subject: Re: [firebird-support] string difficulty

 

  

Den 07.12.2015 13:55, skrev 'checkmail'  <mailto:check_m...@satron.de>
check_m...@satron.de 
[firebird-support]:
> .. and if the ID has the length of 15 chars and only the las * is for 
filling out to 16, i get a wrong result too.
>
> 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..)
>

 <http://www.firebirdsql.org/refdocs/langrefupd25-intfunc-trim.html>
http://www.firebirdsql.org/refdocs/langrefupd25-intfunc-trim.html

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... 'checkmail' check_m...@satron.de [firebird-support]
    • Re: ... Virna Constantin costel...@yahoo.com [firebird-support]
      • ... 'checkmail' check_m...@satron.de [firebird-support]
        • ... Virna Constantin costel...@yahoo.com [firebird-support]
          • ... Virna Constantin costel...@yahoo.com [firebird-support]
            • ... Virna Constantin costel...@yahoo.com [firebird-support]
              • ... 'checkmail' check_m...@satron.de [firebird-support]
                • ... setysvar setys...@gmail.com [firebird-support]
                • ... 'Andrew Zenz' and...@aimsoftware.com.au [firebird-support]
                • ... 'checkmail' check_m...@satron.de [firebird-support]
                • ... 'Andrew Zenz' and...@aimsoftware.com.au [firebird-support]
                • ... 'checkmail' check_m...@satron.de [firebird-support]
          • ... 'checkmail' check_m...@satron.de [firebird-support]
    • Re: ... Alan J Davies alan.dav...@aldis-systems.co.uk [firebird-support]
      • ... 'checkmail' check_m...@satron.de [firebird-support]

Reply via email to