> Left() = Left()
> Mid() = Mid()
> IsNumeric() = IsNumeric()

Note that the IsNumeric() function is quite different between the two
languages. VBScript only cares if the value contains characters which
can appear in a number, including scientific notation. ColdFusion seems
to check to see whether or not the string can be cast as a number. In my
opinion, the ColdFusion function is much more useful as VBScript will
consider ($4,e,,,d,.2.3) to be a numeric value. I've never run into a
situation where ColdFusion returned true from IsNumeric() but then
failed to use the value as a number.

> CInt() = Val()
> CStr() = toString()

ToString() isn't exactly the same as I understand it. CStr() is used in
VBScript to convert simple values to a string. ColdFusion does this
automatically. Though VBScript supposedly does this as well, it seems to
be less reliable (possibly because of default properties on objects and
such), hence the need for CStr(). On the other hand, the ToString()
function in ColdFusion is generally used to convert complex objects
(e.g. XML structures) to strings and control encoding.

> IsUpper() = not sure about this one off hand

Someone has already posted a UDF for this so I won't elaborate. I'll
just note that all ColdFusion comparisons are text insensitive by
default. In the case of functions, it's usually the case that the
function has an equivalent "NoCase" function for case insensitive
operations. For example:

> InStr() = Find() or FindNoCase()
> Left() = Left()

Another thing to watch out for is one based indexes. VBScript sometimes
uses 0 based indexes (arrays), sometimes one based (strings). ColdFusion
pretty much exclusively uses one based indexes. Instead of checking for
-1, you'll need to check for 0 just about everywhere. And, when
manipulating strings, don't overlook the list functions in ColdFusion.

Another important note is that, though ColdFusion doesn't have an
"option explicit", its behavior isn't exactly like VBScript without the
option explicit. In other words, VBScript sans-option-explicit will
allow you to use a variable that hasn't been dimensioned _or_ set.
ColdFusion does not require you to dimension a variable, but it does
require you to set it to something before trying to use it.

I used to program almost exclusively in ColdFusion. Now, one job has me
programming almost exclusively in ASP. I use VBScript because of it's
support for classes. The built in property getters and setters are
really nice. VBScript classes tend to have a lot less overhead than
ColdFusion components so I can use them in places where I wouldn't use
ColdFusion components.

That said, I generally find that ColdFusion is less idiosyncratic (is it
a 0 or 1 based index this time?), more predictable (i.e. in its
conversion between datatypes), and just generally easier to use. When
something does go wrong, error messages tend to be a bit more
informative, and, when in doubt, CFDump it to see what you've got.

Benjamin S. Rogers
http://www.c4.net/
v.508.240.0051
f.508.240.0057

[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to