[Lazarus] Easiest way to "case" strings

Marc Weustink marc at dommelstein.net
Sat Mar 21 14:37:10 CET 2009


Alexander Klenin wrote:
> On Sat, Mar 21, 2009 at 20:03, Vincent Snijders
> <vincent.snijders at gmail.com> wrote:
>> Reenen Laurie schreef:
>>> Hi,
>>>
>>> I'm sure most of you have had this... is there an easy way to have a
>>> case statement that's based on "strings" rather than ordinal types.  Is
>>> there somewhere a shortcut?
>>>
>> You can use stringcase:
>> http://lazarus-ccr.sourceforge.net/docs/lcl/lclproc/stringcase.html
>>
>> Unfortunately without example. It is used in the Lazarus sources, so
>> maybe you find out how to use it from there.
> 
> Hm, this function duplicates AnsiIndexStr / AnsiIndexText which are
> Delphi-compatible. Is there a reason for its existence?

At the time I wrote StringCase, AnsiIndexStr / AnsiIndexText were 
unknown to me. I wonder even if they existed at that time. When did 
delphi introduce them ? (just a coincidence, I just "discovered" them 
last week)

Marc






More information about the Lazarus mailing list