Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2008-03

AnsiDequotedStr not return empty for ""

10 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

zaher dirkey
S := AnsiDequotedStr('""', '"');

Return in S the same source string for empty quoted.

That also in Delphi, but it is for me wrong.
In fact that make my program working wrong when send UserName="Admin" and Password="", it check password as '""' not empty.

Zaher Dirkey
Peter Vreman
to zaher dirkey
zaher dirkey wrote 7 lines
S := AnsiDequotedStr('""', '"'); Return in S the same source string for empty quoted. That also in Delphi, but it is for me wrong. In fact that make my program working wrong when send UserName="Admin" and Password="", it check password as '""' not empty.

The behaviour is compatible with Delphi and will not be changed.

Peter

Micha Nelissen
to Peter Vreman
Peter Vreman wrote 5 lines
> That also in Delphi, but it is for me wrong. > In fact that make my program working wrong when send UserName="Admin" > and Password="", it check password as '""' not empty. The behaviour is compatible with Delphi and will not be changed.

Might as well remove it then, as it seems to me it's pretty useless this way, and people can only get confused in case empty things are not working as expected?

Is there a use case in which you really want the empty quoted string to not remove the quotes?

Micha

Daniël Mantione
to Micha Nelissen

Op Sun, 2 Mar 2008, schreef Micha Nelissen:

Show quoted text 10 lines
Peter Vreman wrote: >> That also in Delphi, but it is for me wrong. >> In fact that make my program working wrong when send UserName="Admin" >> and Password="", it check password as '""' not empty. > > The behaviour is compatible with Delphi and will not be changed. Might as well remove it then, as it seems to me it's pretty useless this way, and people can only get confused in case empty things are not working as expected?

In case always check Delphi documentation to see wether the behaviour you see is intentional.

Daniël

Peter Vreman
to Daniël Mantione
Show quoted text 12 lines
>>> That also in Delphi, but it is for me wrong. >>> In fact that make my program working wrong when send UserName="Admin" >>> and Password="", it check password as '""' not empty. >> >> The behaviour is compatible with Delphi and will not be changed. > > Might as well remove it then, as it seems to me it's pretty useless this > way, and people can only get confused in case empty things are not > working as expected? In case always check Delphi documentation to see wether the behaviour you see is intentional.

In case of "" it is also ambigious what you want. Because "" in the middle of the string is translated to a single ". So you might also expect that it returns a single " instead of an empty string.

Peter

Micha Nelissen
to Peter Vreman
Peter Vreman wrote 6 lines
> In case always check Delphi documentation to see wether the behaviour > you see is intentional. In case of "" it is also ambigious what you want. Because "" in the middle of the string is translated to a single ". So you might also expect that it returns a single " instead of an empty string.

Wouldn't it be reasonable to expect the rules are similar to Pascal itself, with '''' being a single quote, and '' an empty string ?

Micha

zaher dirkey
to Micha Nelissen

Who is need to return the same source if it empty quoted string? That force me to implement a new function to use it.

Micha Nelissen wrote 16 lines
Peter Vreman wrote: >> In case always check Delphi documentation to see wether the behaviour >> you see is intentional. > > In case of "" it is also ambigious what you want. Because "" in the > middle of the string is translated to a single ". So you might also > expect that it returns a single " instead of an empty string. Wouldn't it be reasonable to expect the rules are similar to Pascal itself, with '''' being a single quote, and '' an empty string ? Micha _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Zaher Dirkey
Damien Gerard
to zaher dirkey
zaher dirkey wrote
Who is need to return the same source if it empty quoted string? That force me to implement a new function to use it.

I think the real problem is the Delphi Compatiblity. If the function works the same in Delphi, it must be kept like this. But a new function (with a different name) may be created with a more intuitive behavior.

Show quoted text 15 lines
On Sun, Mar 2, 2008 at 2:17 PM, Micha Nelissen wrote: Peter Vreman wrote: >> In case always check Delphi documentation to see wether the behaviour >> you see is intentional. > > In case of "" it is also ambigious what you want. Because "" in the > middle of the string is translated to a single ". So you might also > expect that it returns a single " instead of an empty string. Wouldn't it be reasonable to expect the rules are similar to Pascal itself, with '''' being a single quote, and '' an empty string ? Micha
Damien Gerard "Intelligence is 10 million rules." -- Douglas Lenat
Joao Morais
to zaher dirkey: Who is need to return the same source if it empty quoted string? That force me to…
zaher dirkey wrote
Who is need to return the same source if it empty quoted string? That force me to implement a new function to use it.

Or use AnsiExtractQuotedStr.

Joao Morais > On Sun, Mar 2, 2008 at 2:17 PM, Micha Nelissen < > > wrote: > > Peter Vreman wrote: > >> In case always check Delphi documentation to see wether the > behaviour > >> you see is intentional. > > > > In case of "" it is also ambigious what you want. Because "" in the > > middle of the string is translated to a single ". So you might also > > expect that it returns a single " instead of an empty string. > > Wouldn't it be reasonable to expect the rules are similar to Pascal > itself, with '''' being a single quote, and '' an empty string ? > > Micha > > > > -- > Zaher Dirkey
zaher dirkey
to Joao Morais

Yes i notices AnsiExtractQuotedStr
but what i excepct when i send Password to my server using AnsiQuotedStr i will use AnsiDequotedStr.

BTW there is a function QuotedStr, and there is no DequotedStr, as i think must implment a new function using AnsiExtractQuotedStr not AnsiDequotedStr.