Untyped Function Usage

Flags uses of a number of specific string-centric but Variant-returning functions in various standard library modules.

Reasoning

Several functions in the standard library take a Variant parameter and return a Variant result, but an equivalent string-returning function taking a string parameter exists and should probably be preferred.

Default severity

Hint

Inspection type

LanguageOpportunities

Examples

This example should trigger a result

MyModule (StandardModule)
Public Sub DoSomething(ByVal foo As Double) Debug.Print Format(foo, "Currency") ' Strings.Format function returns a Variant. End Sub

This example should NOT trigger a result

MyModule (StandardModule)
Public Sub DoSomething(ByVal foo As Double) Debug.Print Format$(CStr(foo), "Currency") ' Strings.Format$ function returns a String. End Sub

Rubberduck.CodeAnalysis.Inspections.Concrete.UntypedFunctionUsageInspection.cs (Prerelease-v2.5.9.6289)