Vote UpVote

A generic case for strings

Lars Fosdal – Do you rememeber the discussion about a case statement for strings? I got this flash idea after reading Jolyon Smith's "The case for case[]", a and remembering a comment from Francisco Ruiz on Nick Hodges' article on a THTMLWriter which suggested using a default array property in a creative fashion.Honestly, it is not really a true case statement, and it might not be as fast as an if then else, but here is how it looks when used. A bit ugly. but good fun :)program TestGenericsSwitch;{$apptype Console}uses  GenericsSwitch;begin TStringSwitch.CaseOf('chARLie') ['Any', ...
Favorite? Off-Topic? Lars Fosdal @ 2010-12-01 21:54


Visits: 607
Votes: 2
Favorites: 0
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Charles Ardour
Jørn E. Angeltveit
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News


Please login or register to use this functionality.
(click on this box to dismiss)