vb6parse 1.0.1

vb6parse is a library for parsing and analyzing VB6 code, from projects, to controls, to modules, and forms.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="VB6Parse Library Reference - formatnumber - String">
    <title>formatnumber - String - VB6Parse Library Reference</title>
    <link rel="stylesheet" href="../../../assets/css/style.css">
    <link rel="stylesheet" href="../../../assets/css/docs-style.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css">
    <script src="../../../assets/js/theme-switcher.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/vbnet.min.js"></script>
    <script>hljs.highlightAll();</script>
</head>
<body>
    <header class="docs-header">
        <div class="container">
            <h1><a href="../../../index.html">VB6Parse</a> / <a href="../../../library/index.html">Library</a> / <a href="../../../library/functions/string/index.html">String</a> / formatnumber</h1>
            <p class="tagline">VB6 Library Reference</p>
        </div>
    </header>

    <nav class="docs-nav">
        <div class="container">
            <a href="../../../index.html">Home</a>
            <a href="../../../library/index.html">Library Reference</a>
            <a href="../../../documentation.html">Documentation</a>
            <a href="https://docs.rs/vb6parse" target="_blank">API Docs</a>
            <a href="https://github.com/scriptandcompile/vb6parse" target="_blank">GitHub</a>
            <button id="theme-toggle" class="theme-toggle" aria-label="Toggle theme">
                <span class="theme-icon">🌙</span>
            </button>
        </div>
    </nav>

    <main class="container">
        
        <article class="library-item">
            <h1 id="formatnumber-function">FormatNumber Function</h1>
<p>Returns an expression formatted as a number.</p>
<h2 id="syntax">Syntax</h2>
<pre><code class="language-vbnet">FormatNumber(expression[, numdigitsafterdecimal[, includeleadingdigit[, useparensfornegativenumbers[, groupdigits]]]])</code></pre>
<h2 id="parameters">Parameters</h2>
<ul>
<li><strong>expression</strong>: Required. Expression to be formatted.</li>
<li><strong>numdigitsafterdecimal</strong>: Optional. <code>Numeric</code> value indicating how many places to the right of the decimal are displayed. Default is -1, which indicates the computer's regional settings are used.</li>
<li><strong>includeleadingdigit</strong>: Optional. Tristate constant that indicates whether a leading zero is displayed for fractional values. See Settings for values.</li>
<li><strong>useparensfornegativenumbers</strong>: Optional. Tristate constant that indicates whether to place negative values within parentheses. See Settings for values.</li>
<li><strong>groupdigits</strong>: Optional. Tristate constant that indicates whether numbers are grouped using the group delimiter specified in the computer's regional settings. See Settings for values.</li>
</ul>
<h2 id="settings">Settings</h2>
<p>The includeleadingdigit, useparensfornegativenumbers, and groupdigits arguments have the following settings:
- <strong>vbTrue</strong> (-1): True
- <strong>vbFalse</strong> (0): False
- <strong>vbUseDefault</strong> (-2): Use the setting from the computer's regional settings</p>
<h2 id="return-value">Return Value</h2>
<p>Returns a Variant of subtype String containing the expression formatted as a number.</p>
<h2 id="remarks">Remarks</h2>
<p>The <code>FormatNumber</code> function provides a simple way to format numeric values using
the system's locale settings. Unlike <code>FormatCurrency</code>, it does not add a currency symbol,
making it ideal for general numeric display.
<strong>Important Characteristics:</strong>
- Uses system locale for formatting
- Default: 2 decimal places (from regional settings)
- Automatically adds thousand separators (if groupdigits=True)
- Negative numbers can be displayed with parentheses or minus sign
- Leading zeros controlled by regional settings or parameter
- No currency symbol added
- Returns empty string if expression is Null
- More convenient than Format for simple number formatting
- Less flexible than Format for custom patterns
- Locale-aware (respects user's regional settings)</p>
<h2 id="typical-uses">Typical Uses</h2>
<ul>
<li>Display numeric values in reports</li>
<li>Format percentages (without % symbol)</li>
<li>Show quantities and measurements</li>
<li>Display statistical values</li>
<li>Format calculated results</li>
<li>Show decimal precision in user interfaces</li>
<li>Display population or large numbers</li>
<li>Format scientific data</li>
</ul>
<h2 id="examples">Examples</h2>
<h3 id="basic-usage">Basic Usage</h3>
<pre><code class="language-vbnet">Dim value As Double
value = 1234.567
&#x27; Default formatting (2 decimal places, system settings)
Debug.Print FormatNumber(value)              &#x27; 1,234.57
&#x27; No decimal places
Debug.Print FormatNumber(value, 0)           &#x27; 1,235
&#x27; Three decimal places
Debug.Print FormatNumber(value, 3)           &#x27; 1,234.567
&#x27; Four decimal places
Debug.Print FormatNumber(value, 4)           &#x27; 1,234.5670</code></pre>
<h3 id="handling-negative-values">Handling Negative Values</h3>
<pre><code class="language-vbnet">Dim negative As Double
negative = -1250.50
&#x27; Default negative (with minus sign)
Debug.Print FormatNumber(negative)           &#x27; -1,250.50
&#x27; Parentheses for negative
Debug.Print FormatNumber(negative, 2, , vbTrue)   &#x27; (1,250.50)
&#x27; No parentheses (explicit)
Debug.Print FormatNumber(negative, 2, , vbFalse)  &#x27; -1,250.50</code></pre>
<h3 id="control-leading-digits">Control Leading Digits</h3>
<pre><code class="language-vbnet">Dim fraction As Double
fraction = 0.75
&#x27; With leading zero (default)
Debug.Print FormatNumber(fraction)           &#x27; 0.75
&#x27; No leading zero
Debug.Print FormatNumber(fraction, 2, vbFalse)    &#x27; .75
&#x27; Explicit leading zero
Debug.Print FormatNumber(fraction, 2, vbTrue)     &#x27; 0.75</code></pre>
<h3 id="control-grouping">Control Grouping</h3>
<pre><code class="language-vbnet">Dim largeNumber As Double
largeNumber = 1234567.89
&#x27; With grouping (thousands separators)
Debug.Print FormatNumber(largeNumber, 2, , , vbTrue)   &#x27; 1,234,567.89
&#x27; Without grouping
Debug.Print FormatNumber(largeNumber, 2, , , vbFalse)  &#x27; 1234567.89</code></pre>
<h2 id="common-patterns">Common Patterns</h2>
<h3 id="display-statistical-results">Display Statistical Results</h3>
<pre><code class="language-vbnet">Sub DisplayStatistics(data() As Double)
    Dim total As Double
    Dim average As Double
    Dim i As Long
    total = 0
    For i = LBound(data) To UBound(data)
        total = total + data(i)
    Next i
    average = total / (UBound(data) - LBound(data) + 1)
    Debug.Print &quot;Count: &quot; &amp; FormatNumber(UBound(data) + 1, 0)
    Debug.Print &quot;Total: &quot; &amp; FormatNumber(total, 2)
    Debug.Print &quot;Average: &quot; &amp; FormatNumber(average, 2)
End Sub</code></pre>
<h3 id="format-population-numbers">Format Population Numbers</h3>
<pre><code class="language-vbnet">Function FormatPopulation(population As Long) As String
    FormatPopulation = FormatNumber(population, 0, , , vbTrue)
End Function
&#x27; Usage
Debug.Print &quot;Population: &quot; &amp; FormatPopulation(8500000)  &#x27; Population: 8,500,000</code></pre>
<h3 id="display-measurement-with-precision">Display Measurement with Precision</h3>
<pre><code class="language-vbnet">Function FormatMeasurement(value As Double, decimals As Integer, _
                           unit As String) As String
    FormatMeasurement = FormatNumber(value, decimals) &amp; &quot; &quot; &amp; unit
End Function
&#x27; Usage
Debug.Print FormatMeasurement(12.5678, 2, &quot;cm&quot;)  &#x27; 12.57 cm
Debug.Print FormatMeasurement(98.6, 1, &quot;°F&quot;)     &#x27; 98.6 °F</code></pre>
<h3 id="format-gridreport-data">Format Grid/Report Data</h3>
<pre><code class="language-vbnet">Sub PopulateDataGrid(grid As MSFlexGrid, values() As Double)
    Dim i As Long
    grid.Rows = UBound(values) + 2
    grid.TextMatrix(0, 0) = &quot;Index&quot;
    grid.TextMatrix(0, 1) = &quot;Value&quot;
    For i = LBound(values) To UBound(values)
        grid.TextMatrix(i + 1, 0) = FormatNumber(i, 0)
        grid.TextMatrix(i + 1, 1) = FormatNumber(values(i), 2)
    Next i
End Sub</code></pre>
<h3 id="display-percentage-without-symbol">Display Percentage (without symbol)</h3>
<pre><code class="language-vbnet">Function FormatPercentValue(value As Double, decimals As Integer) As String
    &#x27; Convert to percentage value (multiply by 100)
    FormatPercentValue = FormatNumber(value * 100, decimals)
End Function
&#x27; Usage
Debug.Print FormatPercentValue(0.1234, 2)    &#x27; 12.34
Debug.Print FormatPercentValue(0.5, 0)       &#x27; 50</code></pre>
<h3 id="format-scorerating-display">Format Score/Rating Display</h3>
<pre><code class="language-vbnet">Function FormatScore(score As Double, maxScore As Double) As String
    Dim percentage As Double
    percentage = (score / maxScore) * 100
    FormatScore = FormatNumber(score, 1) &amp; &quot; / &quot; &amp; _
                  FormatNumber(maxScore, 0) &amp; &quot; (&quot; &amp; _
                  FormatNumber(percentage, 1) &amp; &quot;%)&quot;
End Function
&#x27; Usage
Debug.Print FormatScore(87.5, 100)  &#x27; 87.5 / 100 (87.5%)</code></pre>
<h3 id="display-large-numbers-with-suffixes">Display Large Numbers with Suffixes</h3>
<pre><code class="language-vbnet">Function FormatLargeNumber(value As Double) As String
    Const Million = 1000000
    Const Billion = 1000000000
    If Abs(value) &gt;= Billion Then
        FormatLargeNumber = FormatNumber(value / Billion, 2) &amp; &quot;B&quot;
    ElseIf Abs(value) &gt;= Million Then
        FormatLargeNumber = FormatNumber(value / Million, 2) &amp; &quot;M&quot;
    ElseIf Abs(value) &gt;= 1000 Then
        FormatLargeNumber = FormatNumber(value / 1000, 2) &amp; &quot;K&quot;
    Else
        FormatLargeNumber = FormatNumber(value, 2)
    End If
End Function
&#x27; Usage
Debug.Print FormatLargeNumber(1500000)       &#x27; 1.50M
Debug.Print FormatLargeNumber(2500000000)    &#x27; 2.50B</code></pre>
<h3 id="format-comparison-display">Format Comparison Display</h3>
<pre><code class="language-vbnet">Function FormatComparison(actual As Double, expected As Double) As String
    Dim difference As Double
    Dim percentDiff As Double
    difference = actual - expected
    If expected &lt;&gt; 0 Then
        percentDiff = (difference / expected) * 100
    End If
    FormatComparison = &quot;Actual: &quot; &amp; FormatNumber(actual, 2) &amp; vbCrLf &amp; _
                       &quot;Expected: &quot; &amp; FormatNumber(expected, 2) &amp; vbCrLf &amp; _
                       &quot;Difference: &quot; &amp; FormatNumber(difference, 2, , vbTrue) &amp; vbCrLf &amp; _
                       &quot;% Difference: &quot; &amp; FormatNumber(percentDiff, 2, , vbTrue)
End Function</code></pre>
<h3 id="listbox-population-with-numbers"><code>ListBox</code> Population with Numbers</h3>
<pre><code class="language-vbnet">Sub PopulateNumberList(lst As ListBox, values() As Double, decimals As Integer)
    Dim i As Long
    lst.Clear
    For i = LBound(values) To UBound(values)
        lst.AddItem FormatNumber(values(i), decimals)
    Next i
End Sub</code></pre>
<h3 id="format-database-numeric-display">Format Database Numeric Display</h3>
<pre><code class="language-vbnet">Function GetFormattedNumber(rs As ADODB.Recordset, fieldName As String, _
                            Optional decimals As Integer = 2) As String
    If IsNull(rs.Fields(fieldName).Value) Then
        GetFormattedNumber = &quot;N/A&quot;
    Else
        GetFormattedNumber = FormatNumber(rs.Fields(fieldName).Value, decimals)
    End If
End Function</code></pre>
<h3 id="display-summary-totals">Display Summary Totals</h3>
<pre><code class="language-vbnet">Sub DisplaySummary(items As Collection)
    Dim item As Variant
    Dim count As Long
    Dim total As Double
    Dim average As Double
    Dim maxVal As Double
    Dim minVal As Double
    count = items.Count
    total = 0
    maxVal = -1E+308  &#x27; Smallest possible Double
    minVal = 1E+308   &#x27; Largest possible Double
    For Each item In items
        total = total + item.Value
        If item.Value &gt; maxVal Then maxVal = item.Value
        If item.Value &lt; minVal Then minVal = item.Value
    Next item
    average = total / count
    Debug.Print &quot;Summary Statistics&quot;
    Debug.Print String(50, &quot;=&quot;)
    Debug.Print &quot;Count:   &quot;, FormatNumber(count, 0)
    Debug.Print &quot;Total:   &quot;, FormatNumber(total, 2)
    Debug.Print &quot;Average: &quot;, FormatNumber(average, 2)
    Debug.Print &quot;Maximum: &quot;, FormatNumber(maxVal, 2)
    Debug.Print &quot;Minimum: &quot;, FormatNumber(minVal, 2)
End Sub</code></pre>
<h2 id="advanced-usage">Advanced Usage</h2>
<h3 id="flexible-number-formatter">Flexible Number Formatter</h3>
<pre><code class="language-vbnet">Function FormatNumberEx(value As Double, _
                        Optional decimals As Integer = 2, _
                        Optional useParens As Boolean = False, _
                        Optional useGroups As Boolean = True) As String
    Dim leadingDigit As VbTriState
    Dim parens As VbTriState
    Dim groups As VbTriState
    leadingDigit = vbTrue
    parens = IIf(useParens, vbTrue, vbFalse)
    groups = IIf(useGroups, vbTrue, vbFalse)
    FormatNumberEx = FormatNumber(value, decimals, leadingDigit, parens, groups)
End Function</code></pre>
<h3 id="accounting-style-formatter">Accounting-Style Formatter</h3>
<pre><code class="language-vbnet">Function FormatAccounting(value As Double, Optional decimals As Integer = 2) As String
    &#x27; Always show parentheses for negatives, use grouping
    FormatAccounting = FormatNumber(value, decimals, vbTrue, vbTrue, vbTrue)
End Function
&#x27; Usage
Debug.Print FormatAccounting(1234.56)    &#x27; 1,234.56
Debug.Print FormatAccounting(-789.12)    &#x27; (789.12)</code></pre>
<h3 id="dynamic-precision-formatter">Dynamic Precision Formatter</h3>
<pre><code class="language-vbnet">Function FormatNumberDynamic(value As Double) As String
    &#x27; Adjust precision based on magnitude
    If Abs(value) &gt;= 1000 Then
        &#x27; Large numbers: no decimals
        FormatNumberDynamic = FormatNumber(value, 0)
    ElseIf Abs(value) &gt;= 1 Then
        &#x27; Regular: 2 decimals
        FormatNumberDynamic = FormatNumber(value, 2)
    ElseIf Abs(value) &gt;= 0.01 Then
        &#x27; Small: 4 decimals
        FormatNumberDynamic = FormatNumber(value, 4)
    Else
        &#x27; Very small: 6 decimals
        FormatNumberDynamic = FormatNumber(value, 6)
    End If
End Function</code></pre>
<h3 id="tablereport-alignment">Table/Report Alignment</h3>
<pre><code class="language-vbnet">Function FormatNumberAligned(value As Double, width As Integer, _
                             Optional decimals As Integer = 2) As String
    Dim formatted As String
    formatted = FormatNumber(value, decimals, vbTrue, vbTrue, vbTrue)
    &#x27; Right-align in field
    If Len(formatted) &lt; width Then
        FormatNumberAligned = Space(width - Len(formatted)) &amp; formatted
    Else
        FormatNumberAligned = formatted
    End If
End Function</code></pre>
<h3 id="scientific-data-formatter">Scientific Data Formatter</h3>
<pre><code class="language-vbnet">Function FormatScientificValue(value As Double, _
                               significantDigits As Integer) As String
    If Abs(value) &gt;= 1000 Or Abs(value) &lt; 0.01 Then
        &#x27; Use scientific notation for very large/small
        FormatScientificValue = Format(value, &quot;0.&quot; &amp; String(significantDigits - 1, &quot;0&quot;) &amp; &quot;E+00&quot;)
    Else
        &#x27; Use regular formatting
        FormatScientificValue = FormatNumber(value, significantDigits)
    End If
End Function</code></pre>
<h3 id="conditional-formatting">Conditional Formatting</h3>
<pre><code class="language-vbnet">Function FormatNumberConditional(value As Double) As String
    If value &gt; 0 Then
        FormatNumberConditional = &quot;+&quot; &amp; FormatNumber(value, 2)
    ElseIf value &lt; 0 Then
        FormatNumberConditional = FormatNumber(value, 2, , vbTrue)
    Else
        FormatNumberConditional = FormatNumber(0, 2)
    End If
End Function</code></pre>
<h2 id="error-handling">Error Handling</h2>
<pre><code class="language-vbnet">Function SafeFormatNumber(value As Variant, _
                          Optional decimals As Integer = 2) As String
    On Error GoTo ErrorHandler
    If IsNull(value) Then
        SafeFormatNumber = &quot;N/A&quot;
    ElseIf Not IsNumeric(value) Then
        SafeFormatNumber = &quot;Invalid&quot;
    Else
        SafeFormatNumber = FormatNumber(CDbl(value), decimals)
    End If
    Exit Function
ErrorHandler:
    Select Case Err.Number
        Case 13  &#x27; Type mismatch
            SafeFormatNumber = &quot;Type Error&quot;
        Case 6   &#x27; Overflow
            SafeFormatNumber = &quot;Overflow&quot;
        Case 5   &#x27; Invalid procedure call
            SafeFormatNumber = &quot;Invalid&quot;
        Case Else
            SafeFormatNumber = &quot;Error&quot;
    End Select
End Function</code></pre>
<h3 id="common-errors">Common Errors</h3>
<ul>
<li><strong>Error 13</strong> (Type Mismatch): Expression cannot be converted to numeric</li>
<li><strong>Error 6</strong> (Overflow): Value too large for Double</li>
<li><strong>Error 5</strong> (Invalid procedure call): Invalid decimal places parameter</li>
</ul>
<h2 id="performance-considerations">Performance Considerations</h2>
<ul>
<li><code>FormatNumber</code> is fast for simple formatting</li>
<li>Slightly slower than <code>Format</code> for custom patterns</li>
<li>Faster than building format strings manually</li>
<li>Locale lookups cached by system</li>
<li>Avoid repeated calls in tight loops if possible</li>
<li>Consider caching formatted values for display</li>
</ul>
<h2 id="best-practices">Best Practices</h2>
<h3 id="use-formatnumber-for-general-numeric-display">Use <code>FormatNumber</code> for General Numeric Display</h3>
<pre><code class="language-vbnet">&#x27; Good - Locale-aware, user-friendly
lblValue.Caption = FormatNumber(total, 2)
&#x27; Less portable - Hard-coded format
lblValue.Caption = Format(total, &quot;0.00&quot;)</code></pre>
<h3 id="handle-null-values">Handle Null Values</h3>
<pre><code class="language-vbnet">&#x27; Good - Check for Null
If Not IsNull(value) Then
    formatted = FormatNumber(value, 2)
Else
    formatted = &quot;N/A&quot;
End If</code></pre>
<h3 id="be-consistent-with-decimal-places">Be Consistent with Decimal Places</h3>
<pre><code class="language-vbnet">&#x27; Good - Use constants for consistency
Const DECIMAL_PLACES = 2
result1 = FormatNumber(value1, DECIMAL_PLACES)
result2 = FormatNumber(value2, DECIMAL_PLACES)</code></pre>
<h2 id="comparison-with-other-functions">Comparison with Other Functions</h2>
<h3 id="formatnumber-vs-formatcurrency"><code>FormatNumber</code> vs <code>FormatCurrency</code></h3>
<pre><code class="language-vbnet">&#x27; FormatNumber - No currency symbol
result = FormatNumber(1234.56)          &#x27; 1,234.56
&#x27; FormatCurrency - Adds currency symbol
result = FormatCurrency(1234.56)        &#x27; $1,234.56</code></pre>
<h3 id="formatnumber-vs-format"><code>FormatNumber</code> vs <code>Format</code></h3>
<pre><code class="language-vbnet">&#x27; FormatNumber - Simple, predefined
result = FormatNumber(1234.56, 2)
&#x27; Format - More control, custom patterns
result = Format(1234.56, &quot;#,##0.00&quot;)</code></pre>
<h3 id="formatnumber-vs-formatpercent"><code>FormatNumber</code> vs <code>FormatPercent</code></h3>
<pre><code class="language-vbnet">&#x27; FormatNumber - No percent symbol, no multiplication
result = FormatNumber(0.1234 * 100, 2)  &#x27; 12.34
&#x27; FormatPercent - Multiplies by 100, adds %
result = FormatPercent(0.1234)          &#x27; 12.34%</code></pre>
<h3 id="formatnumber-vs-strcstr"><code>FormatNumber</code> vs <code>Str</code>/<code>CStr</code></h3>
<pre><code class="language-vbnet">&#x27; FormatNumber - Full formatting
result = FormatNumber(1234.56)          &#x27; 1,234.56
&#x27; Str - Basic conversion, no formatting
result = Str(1234.56)                   &#x27; &quot; 1234.56&quot;
&#x27; CStr - Basic conversion
result = CStr(1234.56)                  &#x27; &quot;1234.56&quot;</code></pre>
<h2 id="limitations">Limitations</h2>
<ul>
<li>Uses system locale (cannot specify different locale)</li>
<li>All parameters optional, making errors less obvious</li>
<li>Tristate parameters can be confusing</li>
<li>No built-in rounding mode control</li>
<li>Cannot format with custom patterns</li>
<li>No control over decimal/thousand separators</li>
<li>Limited to numeric types</li>
</ul>
<h2 id="regional-settings-impact">Regional Settings Impact</h2>
<p>The <code>FormatNumber</code> function behavior varies by locale:
- <strong>United States</strong>: 1,234.56
- <strong>European Union</strong>: 1.234,56 (note decimal/thousand separators swapped)
- <strong>Switzerland</strong>: 1'234.56 (apostrophe as separator)
- <strong>India</strong>: 12,34,567.89 (different grouping pattern)</p>
<h2 id="related-functions">Related Functions</h2>
<ul>
<li><code>Format</code>: More flexible formatting with custom patterns</li>
<li><code>FormatCurrency</code>: Format numbers as currency</li>
<li><code>FormatPercent</code>: Format numbers as percentages</li>
<li><code>FormatDateTime</code>: Format date/time values</li>
<li><code>Round</code>: Round numbers to specified decimal places</li>
<li><code>Int</code>: Return integer portion of a number</li>
<li><code>CDbl</code>: Convert expression to Double</li>
<li><code>IsNumeric</code>: Check if expression can be converted to numeric</li>
</ul>
        </article>
        
        <div style="margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border-color);">
            <p>
                <a href="index.html">← Back to String</a> |
                <a href="../index.html">View all functions</a>
            </p>
        </div>

    </main>

    <footer>
        <div class="container">
            <p>&copy; 2024-2026 VB6Parse Contributors. Licensed under the MIT License.</p>
        </div>
    </footer>
</body>
</html>