I have some VB .NET software that interfaces to a load of old (but sound) COM objects. The VB provides a GUI for the COM objects, part of which consists of setting various options on the COM objects - several of which relate to string formatting.
I have a simple pair of VB .NET functions that convert basic %f, %d, %g formats to/from .NET equivalents using a large select case covering specific common strings, but they don't cover all formats. This is the kind of thing I have...
ElseIf f = "%.3f" Then
return "0.000"
ElseIf f = "%.2f" Then
return "0.00"
ElseIf f = "%.1f" Then
return "0.0"
Before I start diving in and making it more versatile with some parsing, does anyone know of a class (eg VB or C# .NET) that provides a decent ready-made implementation? Or perhaps some regexp wizadry could be used?
Many thanks
Tim