realbasic-nug
[Top] [All Lists]

Re: Select Case and case-sensitive strings?

To: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Subject: Re: Select Case and case-sensitive strings?
From: Joe Strout <joe@inspiringapps.com>
Date: Thu, 31 Jul 2008 13:33:53 -0600
Authentication-results: mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by best guess record for domain of realbasic-nug-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug-bounces@lists.realsoftware.com
Delivered-to: listarchive@realsoftware.com
In-reply-to: <33EF913F-876B-4E1F-A190-AC27DF8EC258@tolisgroup.com>
References: <33EF913F-876B-4E1F-A190-AC27DF8EC258@tolisgroup.com>
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com
On Jul 31, 2008, at 1:15 PM, Tim Jones wrote:

Is Select Case support to ignore case with comparing strings?

Yes.

I'm trying to process args() and I'm duplicating an existing Unix tools that's unavailable on OS X and the source is long ago lost. However, the original app had different meanings for different case - i.e.: -s meant one thing while -S meant something else.

Did my nice clean Select Case just become a huge nested If - ElseIf - End If block using StrComp in binary mode?

There's nothing "nested" about it, nor would it be any huger than your Select Case block. In fact it'd be slightly shorter, in terms of the number of lines (though you would have two extra tokens per case line).

You could probably do this with the funky expression syntax (Select Case can do all sorts of bizarre things), but personally, I'd just switch it to an if/elseif structure and have done with it.

Alternatively, you could pass your string through StringUtils.EncodeCase, and then use Select Case.

Best,
- Joe

--
Joe Strout
Inspiring Applications, Inc.
http://www.InspiringApps.com




_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>