Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
STRTRAN() & Null as Replacement
Message
From
06/07/2010 12:07:42
June Kendrick
Kendrick Associates, Inc.
New York, United States
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
Miscellaneous
Thread ID:
01471525
Message ID:
01471536
Views:
62
Intersting.

Foxpro & SQL Server are both Microsoft, so at least they are consistent <g>.

June

>>>>Is the following a bug in STRTRAN()? It happens in VFP 7 & 9.
>>>>
>>>>? ISNULL(STRTRAN('XXX', 'YYY', NULL)) && prints .T.
>>>>
>>>>'YYY' doesn't appear in 'XXX', so why is it substituting NULL in the first place? If the expression sought doesn't exist in the expression to be searched, I would expect to have the expression to be searched returned as is, regardless of the replacement expression.
>>>
>>>Looks like you found a bug! I also would expect this to return 'XXX' instead.
>>
>>Hmm, when you work with NULLs you never know what you should expect. And in most cases you should expect NULL as a result :-)
>>Here a simple SQL Server T-SQL that returns the same (NULL):
>>
>>declare @Test varchar(200)
>>SET @Test = 'YYY'
>>SELECT REPLACE(@test,'XXX',NULL)
>>
>
>Interesting! Since it's a common implementation, then I guess the output is expected? Need more tests in different languages.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform