D.5. New Functions

Several new string-manipulation functions have been introduced into VB6 (or rather, they have been borrowed from VBScript). The functions were originally required by the web programming community, and since VB6 extends Visual Basic further into the web programming arena (with DHTML projects, IIS projects, and web classes), these functions are now required in VB6 as well. But even if you're not planning on doing any web work, you'll find loads of uses for these new functions. The new string manipulation functions are:

  • Filter

  • FormatCurrency

  • FormatDateTime

  • FormatNumber

  • FormatPercent

  • InStrRev

  • Join

  • Replace

  • Split

  • StrReverse

The CallByName function is one of only two really new functions in the VB language. CallByName allows you to call a function by using a string variable to specify the name of the function and a ParamArray to pass the parameters.

A new function that could possibly be placed in the "miscellaneous improvements" category is MonthName, a function that returns the name of the month from a given month number. And Round is a badly overdue rounding function.

For information, see the entry for each new function in Chapter 7.

Get VB & VBA in a Nutshell: The Language now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.