AnsiDequotedStr not return empty for ""

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

AnsiDequotedStr not return empty for ""

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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: AnsiDequotedStr not return empty for ""

Peter Vreman
zaher dirkey wrote:
> 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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: AnsiDequotedStr not return empty for ""

Micha Nelissen
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?

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

Micha
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: AnsiDequotedStr not return empty for ""

Bugzilla from daniel.mantione@freepascal.org


Op Sun, 2 Mar 2008, schreef Micha Nelissen:

> 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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: AnsiDequotedStr not return empty for ""

Peter Vreman
>>>> 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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: AnsiDequotedStr not return empty for ""

Micha Nelissen
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  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: AnsiDequotedStr not return empty for ""

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

On Sun, Mar 2, 2008 at 2:17 PM, Micha Nelissen <[hidden email]> 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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal



--
Zaher Dirkey
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: AnsiDequotedStr not return empty for ""

Damien Gerard

Le Mar 2, 2008 à 6:11 PM, zaher dirkey a écrit :

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.

On Sun, Mar 2, 2008 at 2:17 PM, Micha Nelissen <[hidden email]> 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






_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: AnsiDequotedStr not return empty for ""

Joao Morais
In reply to this post by 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.

Or use AnsiExtractQuotedStr.

--
Joao Morais


> On Sun, Mar 2, 2008 at 2:17 PM, Micha Nelissen <[hidden email]
> <mailto:[hidden email]>> 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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: AnsiDequotedStr not return empty for ""

zaher dirkey
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.


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal