Repository navigation
Expand file tree
/
Copy pathStrings.xml
More file actions
3721 lines (3174 loc) · 256 KB
/
Copy pathStrings.xml
File metadata and controls
3721 lines (3174 loc) · 256 KB
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
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<Type Name="Strings" FullName="Microsoft.VisualBasic.Strings">
<TypeSignature Language="C#" Value="public sealed class Strings" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit Strings extends System.Object" />
<TypeSignature Language="DocId" Value="T:Microsoft.VisualBasic.Strings" />
<TypeSignature Language="VB.NET" Value="Public Module Strings" />
<TypeSignature Language="C++ CLI" Value="public ref class Strings sealed" />
<TypeSignature Language="F#" Value="type Strings = class" />
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>7.0.5000.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-2.2">
<AttributeName>Microsoft.VisualBasic.CompilerServices.StandardModule</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>The <see langword="Strings" /> module contains procedures used to perform string operations.</summary>
<remarks>
<format type="text/markdown"><]
]]></format>
</remarks>
<related type="Article" href="~/docs/visual-basic/language-reference/keywords/string-manipulation-summary.md">String Manipulation Summary</related>
<related type="Article" href="~/docs/visual-basic/language-reference/keywords/index.md">Keywords (Visual Basic)</related>
<related type="Article" href="~/docs/visual-basic/language-reference/runtime-library-members.md">Visual Basic Run-Time Library Members</related>
</Docs>
<Members>
<MemberGroup MemberName="Asc">
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Returns an <see langword="Integer" /> value representing the character code corresponding to a character.</summary>
</Docs>
</MemberGroup>
<Member MemberName="Asc">
<MemberSignature Language="C#" Value="public static int Asc (char String);" />
<MemberSignature Language="ILAsm" Value=".method public static int32 Asc(char String) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.VisualBasic.Strings.Asc(System.Char)" />
<MemberSignature Language="VB.NET" Value="Public Function Asc (String As Char) As Integer" />
<MemberSignature Language="C++ CLI" Value="public:
 static int Asc(char String);" />
<MemberSignature Language="F#" Value="static member Asc : char -> int" Usage="Microsoft.VisualBasic.Strings.Asc String" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>7.0.5000.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="String" Type="System.Char" />
</Parameters>
<Docs>
<param name="String">Required. Any valid <see langword="Char" /> or <see langword="String" /> expression. If <paramref name="String" /> is a <see langword="String" /> expression, only the first character of the string is used for input. If <paramref name="String" /> is <see langword="Nothing" /> or contains no characters, an <see cref="T:System.ArgumentException" /> error occurs.</param>
<summary>Returns an <see langword="Integer" /> value representing the character code corresponding to a character.</summary>
<returns>Returns an <see langword="Integer" /> value representing the character code corresponding to a character.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
`Asc` returns the *code point*, or character code, for the input character. This can be 0 through 255 for single-byte character set (SBCS) values and -32768 through 32767 for double-byte character set (DBCS) values.
`AscW` returns the Unicode code point for the input character. This can be 0 through 65535. The returned value is independent of the culture and code page settings for the current thread.
> [!NOTE]
> The `AscB` function of earlier versions of Visual Basic returns a code for a byte, rather than a character. It is used primarily for converting strings in double-byte character set (DBCS) applications. All Visual Basic 2005 strings are in Unicode, and `AscB` is no longer supported.
## Examples
The following example uses the `Asc` function to return `Integer` character codes corresponding to the first letter in each string.
[!code-vb[VbVbalrFunctions#19](~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrFunctions/VB/Class1.vb#19)]
]]></format>
</remarks>
<altmember cref="M:Microsoft.VisualBasic.Strings.Chr(System.Int32)" />
<altmember cref="M:Microsoft.VisualBasic.Strings.ChrW(System.Int32)" />
<altmember cref="N:System.Globalization" />
<altmember cref="T:System.Globalization.CultureInfo" />
<altmember cref="P:System.Globalization.TextInfo.ANSICodePage" />
<altmember cref="T:System.ArgumentException" />
<related type="Article" href="~/docs/visual-basic/language-reference/functions/index.md">Functions (Visual Basic)</related>
</Docs>
</Member>
<Member MemberName="Asc">
<MemberSignature Language="C#" Value="public static int Asc (string String);" />
<MemberSignature Language="ILAsm" Value=".method public static int32 Asc(string String) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.VisualBasic.Strings.Asc(System.String)" />
<MemberSignature Language="C++ CLI" Value="public:
 static int Asc(System::String ^ String);" />
<MemberSignature Language="F#" Value="static member Asc : string -> int" Usage="Microsoft.VisualBasic.Strings.Asc String" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>7.0.5000.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="String" Type="System.String" />
</Parameters>
<Docs>
<param name="String">Required. Any valid <see langword="Char" /> or <see langword="String" /> expression. If <paramref name="String" /> is a <see langword="String" /> expression, only the first character of the string is used for input. If <paramref name="String" /> is <see langword="Nothing" /> or contains no characters, an <see cref="T:System.ArgumentException" /> error occurs.</param>
<summary>Returns an <see langword="Integer" /> value representing the character code corresponding to a character.</summary>
<returns>Returns an <see langword="Integer" /> value representing the character code corresponding to a character.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
`Asc` returns the *code point*, or character code, for the input character. This can be 0 through 255 for single-byte character set (SBCS) values and -32768 through 32767 for double-byte character set (DBCS) values.
`AscW` returns the Unicode code point for the input character. This can be 0 through 65535. The returned value is independent of the culture and code page settings for the current thread.
> [!NOTE]
> The `AscB` function of earlier versions of Visual Basic returns a code for a byte, rather than a character. It is used primarily for converting strings in double-byte character set (DBCS) applications. All Visual Basic 2005 strings are in Unicode, and `AscB` is no longer supported.
## Examples
The following example uses the `Asc` function to return `Integer` character codes corresponding to the first letter in each string.
[!code-vb[VbVbalrFunctions#19](~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrFunctions/VB/Class1.vb#19)]
]]></format>
</remarks>
<altmember cref="M:Microsoft.VisualBasic.Strings.Chr(System.Int32)" />
<altmember cref="M:Microsoft.VisualBasic.Strings.ChrW(System.Int32)" />
<altmember cref="N:System.Globalization" />
<altmember cref="T:System.Globalization.CultureInfo" />
<altmember cref="P:System.Globalization.TextInfo.ANSICodePage" />
<altmember cref="T:System.ArgumentException" />
<related type="Article" href="~/docs/visual-basic/language-reference/functions/index.md">Functions (Visual Basic)</related>
</Docs>
</Member>
<MemberGroup MemberName="AscW">
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Returns an <see langword="Integer" /> value representing the character code corresponding to a character.</summary>
</Docs>
</MemberGroup>
<Member MemberName="AscW">
<MemberSignature Language="C#" Value="public static int AscW (char String);" />
<MemberSignature Language="ILAsm" Value=".method public static int32 AscW(char String) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.VisualBasic.Strings.AscW(System.Char)" />
<MemberSignature Language="VB.NET" Value="Public Function AscW (String As Char) As Integer" />
<MemberSignature Language="C++ CLI" Value="public:
 static int AscW(char String);" />
<MemberSignature Language="F#" Value="static member AscW : char -> int" Usage="Microsoft.VisualBasic.Strings.AscW String" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>7.0.5000.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="String" Type="System.Char" />
</Parameters>
<Docs>
<param name="String">Required. Any valid <see langword="Char" /> or <see langword="String" /> expression. If <paramref name="String" /> is a <see langword="String" /> expression, only the first character of the string is used for input. If <paramref name="String" /> is <see langword="Nothing" /> or contains no characters, an <see cref="T:System.ArgumentException" /> error occurs.</param>
<summary>Returns an <see langword="Integer" /> value representing the character code corresponding to a character.</summary>
<returns>Returns an <see langword="Integer" /> value representing the character code corresponding to a character.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
`Asc` returns the *code point*, or character code, for the input character. This can be 0 through 255 for single-byte character set (SBCS) values and -32768 through 32767 for double-byte character set (DBCS) values.
`AscW` returns the Unicode code point for the input character. This can be 0 through 65535. The returned value is independent of the culture and code page settings for the current thread.
> [!NOTE]
> The `AscB` function of earlier versions of Visual Basic returns a code for a byte, rather than a character. It is used primarily for converting strings in double-byte character set (DBCS) applications. All Visual Basic 2005 strings are in Unicode, and `AscB` is no longer supported.
## Examples
The following example uses the `Asc` function to return `Integer` character codes corresponding to the first letter in each string.
[!code-vb[VbVbalrFunctions#19](~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrFunctions/VB/Class1.vb#19)]
]]></format>
</remarks>
<altmember cref="M:Microsoft.VisualBasic.Strings.Chr(System.Int32)" />
<altmember cref="M:Microsoft.VisualBasic.Strings.ChrW(System.Int32)" />
<altmember cref="N:System.Globalization" />
<altmember cref="T:System.Globalization.CultureInfo" />
<altmember cref="P:System.Globalization.TextInfo.ANSICodePage" />
<altmember cref="T:System.ArgumentException" />
<related type="Article" href="~/docs/visual-basic/language-reference/functions/index.md">Functions (Visual Basic)</related>
</Docs>
</Member>
<Member MemberName="AscW">
<MemberSignature Language="C#" Value="public static int AscW (string String);" />
<MemberSignature Language="ILAsm" Value=".method public static int32 AscW(string String) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.VisualBasic.Strings.AscW(System.String)" />
<MemberSignature Language="C++ CLI" Value="public:
 static int AscW(System::String ^ String);" />
<MemberSignature Language="F#" Value="static member AscW : string -> int" Usage="Microsoft.VisualBasic.Strings.AscW String" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>7.0.5000.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="String" Type="System.String" />
</Parameters>
<Docs>
<param name="String">Required. Any valid <see langword="Char" /> or <see langword="String" /> expression. If <paramref name="String" /> is a <see langword="String" /> expression, only the first character of the string is used for input. If <paramref name="String" /> is <see langword="Nothing" /> or contains no characters, an <see cref="T:System.ArgumentException" /> error occurs.</param>
<summary>Returns an <see langword="Integer" /> value representing the character code corresponding to a character.</summary>
<returns>Returns an <see langword="Integer" /> value representing the character code corresponding to a character.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
`Asc` returns the *code point*, or character code, for the input character. This can be 0 through 255 for single-byte character set (SBCS) values and -32768 through 32767 for double-byte character set (DBCS) values.
`AscW` returns the Unicode code point for the input character. This can be 0 through 65535. The returned value is independent of the culture and code page settings for the current thread.
> [!NOTE]
> The `AscB` function of earlier versions of Visual Basic returns a code for a byte, rather than a character. It is used primarily for converting strings in double-byte character set (DBCS) applications. All Visual Basic 2005 strings are in Unicode, and `AscB` is no longer supported.
## Examples
The following example uses the `Asc` function to return `Integer` character codes corresponding to the first letter in each string.
[!code-vb[VbVbalrFunctions#19](~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrFunctions/VB/Class1.vb#19)]
]]></format>
</remarks>
<altmember cref="M:Microsoft.VisualBasic.Strings.Chr(System.Int32)" />
<altmember cref="M:Microsoft.VisualBasic.Strings.ChrW(System.Int32)" />
<altmember cref="N:System.Globalization" />
<altmember cref="T:System.Globalization.CultureInfo" />
<altmember cref="P:System.Globalization.TextInfo.ANSICodePage" />
<altmember cref="T:System.ArgumentException" />
<related type="Article" href="~/docs/visual-basic/language-reference/functions/index.md">Functions (Visual Basic)</related>
</Docs>
</Member>
<Member MemberName="Chr">
<MemberSignature Language="C#" Value="public static char Chr (int CharCode);" />
<MemberSignature Language="ILAsm" Value=".method public static char Chr(int32 CharCode) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.VisualBasic.Strings.Chr(System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public Function Chr (CharCode As Integer) As Char" />
<MemberSignature Language="C++ CLI" Value="public:
 static char Chr(int CharCode);" />
<MemberSignature Language="F#" Value="static member Chr : int -> char" Usage="Microsoft.VisualBasic.Strings.Chr CharCode" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>7.0.5000.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Char</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="CharCode" Type="System.Int32" />
</Parameters>
<Docs>
<param name="CharCode">Required. An <see langword="Integer" /> expression representing the <c>code point</c>, or character code, for the character.</param>
<summary>Returns the character associated with the specified character code.</summary>
<returns>Returns the character associated with the specified character code.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The asymmetric range accepted for `CharCode` compensates for the storage differences between the `Short` and the `Integer`. For example, -29183 is a `Short` but +36353 is an `Integer`. This also facilitates compatibility with Visual Basic 6.0.
`Chr` uses the <xref:System.Text.Encoding> class in the <xref:System.Text?displayProperty=nameWithType> namespace to determine if the current thread is using a single-byte character set (SBCS) or a double-byte character set (DBCS). It then takes `CharCode` as a code point in the appropriate set. The range can be 0 through 255 for SBCS characters and -32768 through 65535 for DBCS characters.
The returned value depends on the code page for the current thread, which is contained in the <xref:System.Globalization.TextInfo.ANSICodePage%2A> property of the <xref:System.Globalization.TextInfo> class in the <xref:System.Globalization> namespace. You can obtain <xref:System.Globalization.TextInfo.ANSICodePage%2A> by specifying `System.Globalization.CultureInfo.CurrentCulture.TextInfo.ANSICodePage`.
`ChrW` takes `CharCode` as a Unicode code point. The range is independent of the culture and code page settings for the current thread. Values from -32768 through -1 are treated the same as values in the range +32768 through +65535.
Numbers from 0 through 31 are the same as standard nonprintable ASCII codes. For example, `Chr(10)` returns a line feed character.
> [!NOTE]
> The `ChrB` function in earlier versions of Visual Basic returns a single byte. It is used primarily for converting strings in double-byte character set (DBCS) applications. All strings in Visual Basic and the .NET Framework are in Unicode, and `ChrB` is no longer supported.
## Examples
The following example uses the `Chr` function to return the character associated with the specified character code.
[!code-vb[VbVbalrStrings#7](~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrStrings/VB/Class1.vb#7)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">
<paramref name="CharCode" /> < 0 or > 255 for <see langword="Chr" />.</exception>
<altmember cref="M:Microsoft.VisualBasic.Strings.ChrW(System.Int32)" />
<altmember cref="Overload:Microsoft.VisualBasic.Strings.Asc" />
<altmember cref="Overload:Microsoft.VisualBasic.Strings.AscW" />
<altmember cref="M:Microsoft.VisualBasic.Conversion.Str(System.Object)" />
<altmember cref="T:System.Globalization.CultureInfo" />
<altmember cref="T:System.ArgumentException" />
<related type="Article" href="~/docs/visual-basic/language-reference/keywords/string-manipulation-summary.md">String Manipulation Summary</related>
</Docs>
</Member>
<Member MemberName="ChrW">
<MemberSignature Language="C#" Value="public static char ChrW (int CharCode);" />
<MemberSignature Language="ILAsm" Value=".method public static char ChrW(int32 CharCode) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.VisualBasic.Strings.ChrW(System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public Function ChrW (CharCode As Integer) As Char" />
<MemberSignature Language="C++ CLI" Value="public:
 static char ChrW(int CharCode);" />
<MemberSignature Language="F#" Value="static member ChrW : int -> char" Usage="Microsoft.VisualBasic.Strings.ChrW CharCode" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>7.0.5000.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Char</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="CharCode" Type="System.Int32" />
</Parameters>
<Docs>
<param name="CharCode">Required. An <see langword="Integer" /> expression representing the <c>code point</c>, or character code, for the character.</param>
<summary>Returns the character associated with the specified character code.</summary>
<returns>Returns the character associated with the specified character code.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The asymmetric range accepted for `CharCode` compensates for the storage differences between the `Short` and the `Integer`. For example, -29183 is a `Short` but +36353 is an `Integer`. This also facilitates compatibility with Visual Basic 6.0.
`Chr` uses the <xref:System.Text.Encoding> class in the <xref:System.Text?displayProperty=nameWithType> namespace to determine if the current thread is using a single-byte character set (SBCS) or a double-byte character set (DBCS). It then takes `CharCode` as a code point in the appropriate set. The range can be 0 through 255 for SBCS characters and -32768 through 65535 for DBCS characters.
The returned value depends on the code page for the current thread, which is contained in the <xref:System.Globalization.TextInfo.ANSICodePage%2A> property of the <xref:System.Globalization.TextInfo> class in the <xref:System.Globalization> namespace. You can obtain <xref:System.Globalization.TextInfo.ANSICodePage%2A> by specifying `System.Globalization.CultureInfo.CurrentCulture.TextInfo.ANSICodePage`.
`ChrW` takes `CharCode` as a Unicode code point. The range is independent of the culture and code page settings for the current thread. Values from -32768 through -1 are treated the same as values in the range +32768 through +65535.
Numbers from 0 through 31 are the same as standard nonprintable ASCII codes. For example, `Chr(10)` returns a line feed character.
> [!NOTE]
> The `ChrB` function in earlier versions of Visual Basic returns a single byte. It is used primarily for converting strings in double-byte character set (DBCS) applications. All strings in Visual Basic and the .NET Framework are in Unicode, and `ChrB` is no longer supported.
## Examples
The following example uses the `Chr` function to return the character associated with the specified character code.
[!code-vb[VbVbalrStrings#7](~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrStrings/VB/Class1.vb#7)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">
<paramref name="CharCode" /> < -32768 or > 65535 for <see langword="ChrW" />.</exception>
<altmember cref="M:Microsoft.VisualBasic.Strings.Chr(System.Int32)" />
<altmember cref="Overload:Microsoft.VisualBasic.Strings.Asc" />
<altmember cref="Overload:Microsoft.VisualBasic.Strings.AscW" />
<altmember cref="M:Microsoft.VisualBasic.Conversion.Str(System.Object)" />
<altmember cref="T:System.Globalization.CultureInfo" />
<altmember cref="T:System.ArgumentException" />
<related type="Article" href="~/docs/visual-basic/language-reference/keywords/string-manipulation-summary.md">String Manipulation Summary</related>
</Docs>
</Member>
<MemberGroup MemberName="Filter">
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Returns a zero-based array containing a subset of a <see langword="String" /> array based on specified filter criteria.</summary>
</Docs>
</MemberGroup>
<Member MemberName="Filter">
<MemberSignature Language="C#" Value="public static string[] Filter (object[] Source, string Match, bool Include = true, Microsoft.VisualBasic.CompareMethod Compare = Microsoft.VisualBasic.CompareMethod.Binary);" />
<MemberSignature Language="ILAsm" Value=".method public static string[] Filter(object[] Source, string Match, bool Include, valuetype Microsoft.VisualBasic.CompareMethod Compare) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.VisualBasic.Strings.Filter(System.Object[],System.String,System.Boolean,Microsoft.VisualBasic.CompareMethod)" />
<MemberSignature Language="VB.NET" Value="Public Function Filter (Source As Object(), Match As String, Optional Include As Boolean = true, Optional Compare As CompareMethod = Microsoft.VisualBasic.CompareMethod.Binary) As String()" />
<MemberSignature Language="F#" Value="static member Filter : obj[] * string * bool * Microsoft.VisualBasic.CompareMethod -> string[]" Usage="Microsoft.VisualBasic.Strings.Filter (Source, Match, Include, Compare)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>7.0.5000.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String[]</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="Source" Type="System.Object[]" />
<Parameter Name="Match" Type="System.String" />
<Parameter Name="Include" Type="System.Boolean" />
<Parameter Name="Compare" Type="Microsoft.VisualBasic.CompareMethod">
<Attributes>
<Attribute>
<AttributeName>Microsoft.VisualBasic.CompilerServices.OptionCompare</AttributeName>
</Attribute>
</Attributes>
</Parameter>
</Parameters>
<Docs>
<param name="Source">Required. One-dimensional array of strings to be searched.</param>
<param name="Match">Required. String to search for.</param>
<param name="Include">Optional. <see langword="Boolean" /> value indicating whether to return substrings that include or exclude <paramref name="Match" />. If <paramref name="Include" /> is <see langword="True" />, the <see langword="Filter" /> function returns the subset of the array that contains <paramref name="Match" /> as a substring. If <paramref name="Include" /> is <see langword="False" />, the <see langword="Filter" /> function returns the subset of the array that does not contain <paramref name="Match" /> as a substring.</param>
<param name="Compare">Optional. Numeric value indicating the kind of string comparison to use. See "Settings" for values.</param>
<summary>Returns a zero-based array containing a subset of a <see langword="String" /> array based on specified filter criteria.</summary>
<returns>Returns a zero-based array containing a subset of a <see langword="String" /> array based on specified filter criteria.</returns>
<remarks>
<format type="text/markdown"><]
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">
<paramref name="Source" /> is <see langword="Nothing" /> or is not a one-dimensional array.</exception>
<altmember cref="M:Microsoft.VisualBasic.Strings.Replace(System.String,System.String,System.String,System.Int32,System.Int32,Microsoft.VisualBasic.CompareMethod)" />
<altmember cref="T:System.ArgumentException" />
<related type="Article" href="~/docs/visual-basic/language-reference/keywords/string-manipulation-summary.md">String Manipulation Summary</related>
</Docs>
</Member>
<Member MemberName="Filter">
<MemberSignature Language="C#" Value="public static string[] Filter (string[] Source, string Match, bool Include = true, Microsoft.VisualBasic.CompareMethod Compare = Microsoft.VisualBasic.CompareMethod.Binary);" />
<MemberSignature Language="ILAsm" Value=".method public static string[] Filter(string[] Source, string Match, bool Include, valuetype Microsoft.VisualBasic.CompareMethod Compare) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.VisualBasic.Strings.Filter(System.String[],System.String,System.Boolean,Microsoft.VisualBasic.CompareMethod)" />
<MemberSignature Language="VB.NET" Value="Public Function Filter (Source As String(), Match As String, Optional Include As Boolean = true, Optional Compare As CompareMethod = Microsoft.VisualBasic.CompareMethod.Binary) As String()" />
<MemberSignature Language="F#" Value="static member Filter : string[] * string * bool * Microsoft.VisualBasic.CompareMethod -> string[]" Usage="Microsoft.VisualBasic.Strings.Filter (Source, Match, Include, Compare)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>7.0.5000.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String[]</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="Source" Type="System.String[]" />
<Parameter Name="Match" Type="System.String" />
<Parameter Name="Include" Type="System.Boolean" />
<Parameter Name="Compare" Type="Microsoft.VisualBasic.CompareMethod">
<Attributes>
<Attribute>
<AttributeName>Microsoft.VisualBasic.CompilerServices.OptionCompare</AttributeName>
</Attribute>
</Attributes>
</Parameter>
</Parameters>
<Docs>
<param name="Source">Required. One-dimensional array of strings to be searched.</param>
<param name="Match">Required. String to search for.</param>
<param name="Include">Optional. <see langword="Boolean" /> value indicating whether to return substrings that include or exclude <paramref name="Match" />. If <paramref name="Include" /> is <see langword="True" />, the <see langword="Filter" /> function returns the subset of the array that contains <paramref name="Match" /> as a substring. If <paramref name="Include" /> is <see langword="False" />, the <see langword="Filter" /> function returns the subset of the array that does not contain <paramref name="Match" /> as a substring.</param>
<param name="Compare">Optional. Numeric value indicating the kind of string comparison to use. See "Settings" for values.</param>
<summary>Returns a zero-based array containing a subset of a <see langword="String" /> array based on specified filter criteria.</summary>
<returns>Returns a zero-based array containing a subset of a <see langword="String" /> array based on specified filter criteria.</returns>
<remarks>
<format type="text/markdown"><]
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">
<paramref name="Source" /> is <see langword="Nothing" /> or is not a one-dimensional array.</exception>
<altmember cref="M:Microsoft.VisualBasic.Strings.Replace(System.String,System.String,System.String,System.Int32,System.Int32,Microsoft.VisualBasic.CompareMethod)" />
<altmember cref="T:System.ArgumentException" />
<related type="Article" href="~/docs/visual-basic/language-reference/keywords/string-manipulation-summary.md">String Manipulation Summary</related>
</Docs>
</Member>
<Member MemberName="Format">
<MemberSignature Language="C#" Value="public static string Format (object Expression, string Style = "");" />
<MemberSignature Language="ILAsm" Value=".method public static string Format(object Expression, string Style) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.VisualBasic.Strings.Format(System.Object,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Function Format (Expression As Object, Optional Style As String = "") As String" />
<MemberSignature Language="F#" Value="static member Format : obj * string -> string" Usage="Microsoft.VisualBasic.Strings.Format (Expression, Style)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>7.0.5000.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="Expression" Type="System.Object" />
<Parameter Name="Style" Type="System.String" />
</Parameters>
<Docs>
<param name="Expression">Required. Any valid expression.</param>
<param name="Style">Optional. A valid named or user-defined format <see langword="String" /> expression.</param>
<summary>Returns a string formatted according to instructions contained in a format <see langword="String" /> expression.</summary>
<returns>Returns a string formatted according to instructions contained in a format <see langword="String" /> expression.</returns>
<remarks>
<format type="text/markdown"><]
If you include semicolons with nothing between them, the missing section is printed using the format of the positive value. For example, the following format displays positive and negative values using the format in the first section and displays `Zero` if the value is zero.
[!code-vb[VbVbalrStrings#19](~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrStrings/VB/Class1.vb#19)]
## Predefined Numeric Formats
The following table identifies the predefined numeric format names. These may be used by name as the `Style` argument for the `Format` function:
|Format name|Description|
|-|-|
|`General Number`, `G`, or `g`|Displays number with no thousand separator.<br /><br /> For example, `Format(&H3FA, "g")` returns `1018`.|
|`Currency`, `C`, or `c`|Displays number with thousand separator, if appropriate; displays two digits to the right of the decimal separator. Output is based on system locale settings.<br /><br /> For example, `Format(1234567, "c")` returns `$1,234,567.00`.|
|`Fixed`, `F`, or `f`|Displays at least one digit to the left and two digits to the right of the decimal separator.<br /><br /> For example, `Format(1234567, "f")` returns `1234567.00`.|
|`Standard`, `N`, or `n`|Displays number with thousand separator, at least one digit to the left and two digits to the right of the decimal separator.<br /><br /> For example, `Format(1234567, "n")` returns `1,234,567.00`.|
|`Percent`|Displays number multiplied by 100 with a percent sign (%) appended immediately to the right; always displays two digits to the right of the decimal separator.<br /><br /> For example, `Format(0.4744, "Percent")` returns `47.44%`.|
|`P`, or `p`|Displays number with thousandths separator multiplied by 100 with a percent sign (%) appended to the right and separated by a single space; always displays two digits to the right of the decimal separator.<br /><br /> For example, `Format(0.80345, "p")` returns `80.35 %`.|
|`Scientific`|Uses standard scientific notation, providing two significant digits.<br /><br /> For example, `Format(1234567, "Scientific")` returns `1.23E+06`.|
|`E`, or `e`|Uses standard scientific notation, providing six significant digits.<br /><br /> For example, `Format(1234567, "e")` returns `1.234567e+006`.|
|`D`, or `d`|Displays number as a string that contains the value of the number in Decimal (base 10) format. This option is supported for integral types (`Byte`, `Short`, `Integer`, `Long`) only.<br /><br /> For example, `Format(&H7F, "d")` returns `127`.|
|`X`, or `x`|Displays number as a string that contains the value of the number in Hexadecimal (base 16) format. This option is supported for integral types (`Byte`, `Short`, `Integer`, `Long`) only.<br /><br /> For example, `Format(127, "x")` returns `7f`.|
|`Yes/No`|Displays `No` if number is 0; otherwise, displays `Yes`.<br /><br /> For example, `Format(0, "Yes/No")` returns `No`.|
|`True/False`|Displays `False` if number is 0; otherwise, displays `True`.<br /><br /> For example, `Format(1, "True/False")` returns `True`.|
|`On/Off`|Displays `Off` if number is 0; otherwise, displays `On`.<br /><br /> For example, `Format(1, "On/Off")` returns `On`.|
### Smart Device Developer Notes
The `Yes/No`, `True/False`, and `On/Off` formats are not supported.
## User-Defined Numeric Formats
The following table identifies characters you can use to create user-defined number formats. These may be used to build the `Style` argument for the `Format` function:
|Character|Description|
|-|-|
|None|Displays the number with no formatting.|
|(`0`)|Digit placeholder. Displays a digit or a zero. If the expression has a digit in the position where the zero appears in the format string, display it; otherwise, displays a zero in that position.<br /><br /> If the number has fewer digits than there are zeros (on either side of the decimal) in the format expression, displays leading or trailing zeros. If the number has more digits to the right of the decimal separator than there are zeros to the right of the decimal separator in the format expression, rounds the number to as many decimal places as there are zeros. If the number has more digits to the left of the decimal separator than there are zeros to the left of the decimal separator in the format expression, displays the extra digits without modification.|
|(`#`)|Digit placeholder. Displays a digit or nothing. If the expression has a digit in the position where the `#` character appears in the format string, displays it; otherwise, displays nothing in that position.<br /><br /> This symbol works like the `0` digit placeholder, except that leading and trailing zeros aren't displayed if the number has fewer digits than there are `#` characters on either side of the decimal separator in the format expression.|
|(`.`)|Decimal placeholder. The decimal placeholder determines how many digits are displayed to the left and right of the decimal separator. If the format expression contains only `#` characters to the left of this symbol; numbers smaller than 1 begin with a decimal separator. To display a leading zero displayed with fractional numbers, use zero as the first digit placeholder to the left of the decimal separator. In some locales, a comma is used as the decimal separator. The actual character used as a decimal placeholder in the formatted output depends on the number format recognized by your system. Thus, you should use the period as the decimal placeholder in your formats even if you are in a locale that uses a comma as a decimal placeholder. The formatted string will appear in the format correct for the locale.|
|(`%`)|Percent placeholder. Multiplies the expression by 100. The percent character (`%`) is inserted in the position where it appears in the format string.|
|(`,`)|Thousand separator. The thousand separator separates thousands from hundreds within a number that has four or more places to the left of the decimal separator. Standard use of the thousand separator is specified if the format contains a thousand separator surrounded by digit placeholders (`0` or `#`).<br /><br /> A thousand separator immediately to the left of the decimal separator (whether or not a decimal is specified) or as the rightmost character in the string means "scale the number by dividing it by 1,000, rounding as needed." Numbers smaller than 1,000 but greater or equal to 500 are displayed as `1`, and numbers smaller than 500 are displayed as `0`. Two adjacent thousand separators in this position scale by a factor of 1 million, and an additional factor of 1,000 for each additional separator.<br /><br /> Multiple separators in any position other than immediately to the left of the decimal separator or the rightmost position in the string are treated simply as specifying the use of a thousand separator. In some locales, a period is used as a thousand separator. The actual character used as the thousand separator in the formatted output depends on the Number Format recognized by your system. Thus, you should use the comma as the thousand separator in your formats even if you are in a locale that uses a period as a thousand separator. The formatted string will appear in the format correct for the locale.<br /><br /> For example, consider the three following format strings:<br /><br /> - `"#,0."`, which uses the thousands separator to format the number 100 million as the string "100,000,000".<br />- `"#0,."`, which uses scaling by a factor of one thousand to format the number 100 million as the string "100000".<br />- `"#,0,."`, which uses the thousands separator and scaling by one thousand to format the number 100 million as the string "100,000".|
|(`:`)|Time separator. In some locales, other characters may be used to represent the time separator. The time separator separates hours, minutes, and seconds when time values are formatted. The actual character used as the time separator in formatted output is determined by your system settings.|
|(`/`)|Date separator. In some locales, other characters may be used to represent the date separator. The date separator separates the day, month, and year when date values are formatted. The actual character used as the date separator in formatted output is determined by your system settings.|
|(`E-``E+``e-``e+`)|Scientific format. If the format expression contains at least one digit placeholder (`0` or `#`) to the left of `E-`, `E+`, `e-`, or `e+`, the number is displayed in scientific format and `E` or `e` is inserted between the number and its exponent. The number of digit placeholders to the left determines the number of digits in the exponent. Use `E-` or `e-` to place a minus sign next to negative exponents. Use `E+` or `e+` to place a minus sign next to negative exponents and a plus sign next to positive exponents. You must also include digit placeholders to the right of this symbol to get correct formatting.|
|`-` `+` `$` ( )|Literal characters. These characters are displayed exactly as typed in the format string. To display a character other than one of those listed, precede it with a backslash (`\`) or enclose it in double quotation marks (" ").|
|(`\`)|Displays the next character in the format string. To display a character that has special meaning as a literal character, precede it with a backslash (`\`). The backslash itself isn't displayed. Using a backslash is the same as enclosing the next character in double quotation marks. To display a backslash, use two backslashes (`\\`).<br /><br /> Examples of characters that can't be displayed as literal characters are the date-formatting and time-formatting characters (`a`, `c`, `d`, `h`, `m`, `n`, `p`, `q`, `s`, `t`, `w`, `y`, `/`, and `:`), the numeric-formatting characters (`#`, `0`, `%`, `E`, `e`, comma, and period), and the string-formatting characters (`@`, `&`, `<`, `>`, and `!`).|
|(`"``ABC``"`)|Displays the string inside the double quotation marks (" "). To include a string in the style argument from within code, you must use `Chr(34)` to enclose the text (`34` is the character code for a quotation mark (")).|
### Legacy Code Example
The following table contains some sample format expressions for numbers. (These examples all assume that your system's locale setting is English-U.S.) The first column contains the format strings for the `Style` argument of the `Format` function; the other columns contain the resulting output if the formatted data has the value given in the column headings.
|Format (`Style`)|"5" formatted as|"-5" formatted as|"0.5" formatted as|
|-|-|-|-|
|`Zero-length string ("")`|`5`|`-5`|`0.5`|
|`0`|`5`|`-5`|`1`|
|`0.00`|`5.00`|`-5.00`|`0.50`|
|`#,##0`|`5`|`-5`|`1`|
|`$#,##0;($#,##0)`|`$5`|`($5)`|`$1`|
|`$#,##0.00;($#,##0.00)`|`$5.00`|`($5.00)`|`$0.50`|
|`0%`|`500%`|`-500%`|`50%`|
|`0.00%`|`500.00%`|`-500.00%`|`50.00%`|
|`0.00E+00`|`5.00E+00`|`-5.00E+00`|`5.00E-01`|
|`0.00E-00`|`5.00E00`|`-5.00E00`|`5.00E-01`|
## Predefined Date/Time Formats
The following table identifies the predefined date and time format names. These may be used by name as the style argument for the `Format` function:
|Format Name|Description|
|-|-|
|`General Date`, or `G`|Displays a date and/or time. For example, `3/12/2008 11:07:31 AM`. Date display is determined by your application's current culture value.|
|`Long Date`, `Medium Date`, or `D`|Displays a date according to your current culture's long date format. For example, `Wednesday, March 12, 2008`.|
|`Short Date`, or `d`|Displays a date using your current culture's short date format. For example, `3/12/2008`.<br /><br /> The `d` character displays the day in a user-defined date format.|
|`Long Time`, `Medium Time`, or `T`|Displays a time using your current culture's long time format; typically includes hours, minutes, seconds. For example, `11:07:31 AM`.|
|`Short Time` or `t`|Displays a time using your current culture's short time format. For example, `11:07 AM`.<br /><br /> The `t` character displays `AM` or `PM` values for locales that use a 12-hour clock in a user-defined time format.|
|`f`|Displays the long date and short time according to your current culture's format. For example, `Wednesday, March 12, 2008 11:07 AM`.|
|`F`|Displays the long date and long time according to your current culture's format. For example, `Wednesday, March 12, 2008 11:07:31 AM`.|
|`g`|Displays the short date and short time according to your current culture's format. For example, `3/12/2008 11:07 AM`.|
|`M`, `m`|Displays the month and the day of a date. For example, `March 12`.<br /><br /> The `M` character displays the month in a user-defined date format. The `m` character displays the minutes in a user-defined time format.|
|`R`, `r`|Formats the date according to the <xref:System.Globalization.DateTimeFormatInfo.RFC1123Pattern%2A> property. For example, `Wed, 12 Mar 2008 11:07:31 GMT`. The formatted date does not adjust the value of the date and time. You must adjust the Date/Time value to GMT before calling the `Format` function.|
|`s`|Formats the date and time as a sortable index. For example, `2008-03-12T11:07:31`.<br /><br /> The `s` character displays the seconds in a user-defined time format.|
|`u`|Formats the date and time as a GMT sortable index. For example, `2008-03-12 11:07:31Z`.|
|`U`|Formats the date and time with the long date and long time as GMT. For example, `Wednesday, March 12, 2008 6:07:31 PM`.|
|`Y`, `y`|Formats the date as the year and month. For example, `March, 2008`.<br /><br /> The `Y` and `y` characters display the year in a user-defined date format.|
For more information about the application's current culture information, see [How Culture Affects Strings in Visual Basic](~/docs/visual-basic/programming-guide/language-features/strings/how-culture-affects-strings.md).
## User-Defined Date/Time Formats
The following table shows characters you can use to create user-defined date/time formats. Unlike in earlier versions of Visual Basic, these format characters are case-sensitive.
|Character|Description|
|-|-|
|(`:`)|Time separator. In some locales, other characters may be used to represent the time separator. The time separator separates hours, minutes, and seconds when time values are formatted. The actual character that is used as the time separator in formatted output is determined by your application's current culture value.|
|(`/`)|Date separator. In some locales, other characters may be used to represent the date separator. The date separator separates the day, month, and year when date values are formatted. The actual character that is used as the date separator in formatted output is determined by your application's current culture.|
|(`%`)|Used to indicate that the following character should be read as a single-letter format without regard to any trailing letters. Also used to indicate that a single-letter format is read as a user-defined format. See what follows for additional details.|
|`d`|Displays the day as a number without a leading zero (for example, `1`). Use `%d` if this is the only character in your user-defined numeric format.|
|`dd`|Displays the day as a number with a leading zero (for example, `01`).|
|`ddd`|Displays the day as an abbreviation (for example, `Sun`).|
|`dddd`|Displays the day as a full name (for example, `Sunday`).|
|`M`|Displays the month as a number without a leading zero (for example, January is represented as `1`). Use `%M` if this is the only character in your user-defined numeric format.|
|`MM`|Displays the month as a number with a leading zero (for example, `01/12/01`).|
|`MMM`|Displays the month as an abbreviation (for example, `Jan`).|
|`MMMM`|Displays the month as a full month name (for example, `January`).|
|`gg`|Displays the period/era string (for example, `A.D.`).|
|`h`|Displays the hour as a number without leading zeros using the 12-hour clock (for example, `1:15:15 PM`). Use `%h` if this is the only character in your user-defined numeric format.|
|`hh`|Displays the hour as a number with leading zeros using the 12-hour clock (for example, `01:15:15 PM`).|
|`H`|Displays the hour as a number without leading zeros using the 24-hour clock (for example, `1:15:15`). Use `%H` if this is the only character in your user-defined numeric format.|
|`HH`|Displays the hour as a number with leading zeros using the 24-hour clock (for example, `01:15:15`).|
|`m`|Displays the minute as a number without leading zeros (for example, `12:1:15`). Use `%m` if this is the only character in your user-defined numeric format.|
|`mm`|Displays the minute as a number with leading zeros (for example, `12:01:15`).|
|`s`|Displays the second as a number without leading zeros (for example, `12:15:5`). Use `%s` if this is the only character in your user-defined numeric format.|
|`ss`|Displays the second as a number with leading zeros (for example, `12:15:05`).|
|`f`|Displays fractions of seconds. For example `ff` displays hundredths of seconds, whereas `ffff` displays ten-thousandths of seconds. You may use up to seven `f` symbols in your user-defined format. Use `%f` if this is the only character in your user-defined numeric format.|
|`t`|Uses the 12-hour clock and displays an uppercase `A` for any hour before noon; displays an uppercase `P` for any hour between noon and 11:59 P.M. Use `%t` if this is the only character in your user-defined numeric format.|
|`tt`|For locales that use a 12-hour clock, displays an uppercase `AM` with any hour before noon; displays an uppercase `PM` with any hour between noon and 11:59 P.M.<br /><br /> For locales that use a 24-hour clock, displays nothing.|
|`y`|Displays the year number (0-9) without leading zeros. Use `%y` if this is the only character in your user-defined numeric format.|
|`yy`|Displays the year in two-digit numeric format with a leading zero, if applicable.|
|`yyy`|Displays the year in four-digit numeric format.|
|`yyyy`|Displays the year in four-digit numeric format.|
|`z`|Displays the timezone offset without a leading zero (for example, `-8`). Use `%z` if this is the only character in your user-defined numeric format.|
|`zz`|Displays the timezone offset with a leading zero (for example, `-08`)|
|`zzz`|Displays the full timezone offset (for example, `-08:00`)|
### Legacy Code Example
The following are examples of user-defined date and time formats for `December 7, 1958, 8:50 PM, 35 seconds`:
|Format|Displays|
|-|-|
|`M/d/yy`|`12/7/58`|
|`d-MMM`|`7-Dec`|
|`d-MMMM-yy`|`7-December-58`|
|`d MMMM`|`7 December`|
|`MMMM yy`|`December 58`|
|`hh:mm tt`|`08:50 PM`|
|`h:mm:ss t`|`8:50:35 P`|
|`H:mm`|`20:50`|
|`H:mm:ss`|`20:50:35`|
|`M/d/yyyy H:mm`|`12/7/1958 20:50`|
### Smart Device Developer Notes
The minimum time resolution for a device is determined by the manufacturer of the device. If the time resolution for the device is coarse enough, the `f` format character returns 0 when run on that device.
## Examples
This example shows various uses of the `Format` function to format values using both `String` formats and user-defined formats. For the date separator (`/`), time separator (`:`), and the AM/PM indicators (`t` and `tt`), the actual formatted output displayed by your system depends on the locale settings the code is using. When times and dates are displayed in the development environment, the short time format and short date format of the code locale are used.
> [!NOTE]
> For locales that use a 24-hour clock, the AM/PM indicators (`t` and `tt`) display nothing.
[!code-vb[VbVbalrStrings#27](~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrStrings/VB/Class1.vb#27)]
]]></format>
</remarks>
<altmember cref="M:System.String.Format(System.String,System.Object)" />
<altmember cref="M:Microsoft.VisualBasic.Conversion.Str(System.Object)" />
<related type="Article" href="~/docs/visual-basic/language-reference/keywords/string-manipulation-summary.md">String Manipulation Summary</related>
</Docs>
</Member>
<Member MemberName="FormatCurrency">
<MemberSignature Language="C#" Value="public static string FormatCurrency (object Expression, int NumDigitsAfterDecimal = -1, Microsoft.VisualBasic.TriState IncludeLeadingDigit = Microsoft.VisualBasic.TriState.UseDefault, Microsoft.VisualBasic.TriState UseParensForNegativeNumbers = Microsoft.VisualBasic.TriState.UseDefault, Microsoft.VisualBasic.TriState GroupDigits = Microsoft.VisualBasic.TriState.UseDefault);" />
<MemberSignature Language="ILAsm" Value=".method public static string FormatCurrency(object Expression, int32 NumDigitsAfterDecimal, valuetype Microsoft.VisualBasic.TriState IncludeLeadingDigit, valuetype Microsoft.VisualBasic.TriState UseParensForNegativeNumbers, valuetype Microsoft.VisualBasic.TriState GroupDigits) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.VisualBasic.Strings.FormatCurrency(System.Object,System.Int32,Microsoft.VisualBasic.TriState,Microsoft.VisualBasic.TriState,Microsoft.VisualBasic.TriState)" />
<MemberSignature Language="VB.NET" Value="Public Function FormatCurrency (Expression As Object, Optional NumDigitsAfterDecimal As Integer = -1, Optional IncludeLeadingDigit As TriState = Microsoft.VisualBasic.TriState.UseDefault, Optional UseParensForNegativeNumbers As TriState = Microsoft.VisualBasic.TriState.UseDefault, Optional GroupDigits As TriState = Microsoft.VisualBasic.TriState.UseDefault) As String" />
<MemberSignature Language="F#" Value="static member FormatCurrency : obj * int * Microsoft.VisualBasic.TriState * Microsoft.VisualBasic.TriState * Microsoft.VisualBasic.TriState -> string" Usage="Microsoft.VisualBasic.Strings.FormatCurrency (Expression, NumDigitsAfterDecimal, IncludeLeadingDigit, UseParensForNegativeNumbers, GroupDigits)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>7.0.5000.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="Expression" Type="System.Object" />
<Parameter Name="NumDigitsAfterDecimal" Type="System.Int32" />
<Parameter Name="IncludeLeadingDigit" Type="Microsoft.VisualBasic.TriState" />
<Parameter Name="UseParensForNegativeNumbers" Type="Microsoft.VisualBasic.TriState" />
<Parameter Name="GroupDigits" Type="Microsoft.VisualBasic.TriState" />
</Parameters>
<Docs>
<param name="Expression">Required. Expression to be formatted.</param>
<param name="NumDigitsAfterDecimal">Optional. Numeric value indicating how many places are displayed to the right of the decimal. Default value is -1, which indicates that the computer's regional settings are used.</param>
<param name="IncludeLeadingDigit">Optional. <see cref="T:Microsoft.VisualBasic.TriState" /> enumeration that indicates whether or not a leading zero is displayed for fractional values. See "Remarks" for values.</param>
<param name="UseParensForNegativeNumbers">Optional. <see cref="T:Microsoft.VisualBasic.TriState" /> enumeration that indicates whether or not to place negative values within parentheses. See "Remarks" for values.</param>
<param name="GroupDigits">Optional. <see cref="T:Microsoft.VisualBasic.TriState" /> enumeration that indicates whether or not numbers are grouped using the group delimiter specified in the computer's regional settings. See "Remarks" for values.</param>
<summary>Returns an expression formatted as a currency value using the currency symbol defined in the system control panel.</summary>
<returns>Returns an expression formatted as a currency value using the currency symbol defined in the system control panel.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When one or more optional arguments are omitted, the computer's matching regional-settings values are used instead.
The position of the currency symbol relative to the currency value is determined by the system's regional settings.
> [!NOTE]
> All settings information comes from the locale of the application. By default, that will be the locale set in the control panel. However, it may be changed programmatically by using the .NET Framework, except leading zero, which comes from the `Number` tab.
The `IncludeLeadingDigit`, `UseParensForNegativeNumbers`, and `GroupDigits` arguments take the following TriState enumeration values.
|Value|Description|
|-|-|
|`TriState.True`|True|
|`TriState.False`|False|
|`TriState.UseDefault`|The computer's regional settings|
## Examples
The following example illustrates the use of the `FormatCurrency` function.
[!code-vb[VbVbalrStrings#32](~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrStrings/VB/Class1.vb#32)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">Number of digits after decimal point is greater than 99.</exception>
<exception cref="T:System.InvalidCastException">Type is not numeric.</exception>
<altmember cref="M:Microsoft.VisualBasic.Strings.FormatDateTime(System.DateTime,Microsoft.VisualBasic.DateFormat)" />
<altmember cref="M:Microsoft.VisualBasic.Strings.FormatNumber(System.Object,System.Int32,Microsoft.VisualBasic.TriState,Microsoft.VisualBasic.TriState,Microsoft.VisualBasic.TriState)" />
<altmember cref="M:Microsoft.VisualBasic.Strings.FormatPercent(System.Object,System.Int32,Microsoft.VisualBasic.TriState,Microsoft.VisualBasic.TriState,Microsoft.VisualBasic.TriState)" />
<altmember cref="T:Microsoft.VisualBasic.TriState" />
<altmember cref="M:Microsoft.VisualBasic.Strings.Format(System.Object,System.String)" />
<altmember cref="T:System.ArgumentException" />
<altmember cref="T:System.InvalidCastException" />
<related type="Article" href="~/docs/visual-basic/language-reference/keywords/string-manipulation-summary.md">String Manipulation</related>
</Docs>
</Member>
<Member MemberName="FormatDateTime">
<MemberSignature Language="C#" Value="public static string FormatDateTime (DateTime Expression, Microsoft.VisualBasic.DateFormat NamedFormat = Microsoft.VisualBasic.DateFormat.GeneralDate);" />
<MemberSignature Language="ILAsm" Value=".method public static string FormatDateTime(valuetype System.DateTime Expression, valuetype Microsoft.VisualBasic.DateFormat NamedFormat) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.VisualBasic.Strings.FormatDateTime(System.DateTime,Microsoft.VisualBasic.DateFormat)" />
<MemberSignature Language="VB.NET" Value="Public Function FormatDateTime (Expression As DateTime, Optional NamedFormat As DateFormat = Microsoft.VisualBasic.DateFormat.GeneralDate) As String" />
<MemberSignature Language="F#" Value="static member FormatDateTime : DateTime * Microsoft.VisualBasic.DateFormat -> string" Usage="Microsoft.VisualBasic.Strings.FormatDateTime (Expression, NamedFormat)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>7.0.5000.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="Expression" Type="System.DateTime" />
<Parameter Name="NamedFormat" Type="Microsoft.VisualBasic.DateFormat" />
</Parameters>
<Docs>
<param name="Expression">Required. <see langword="Date" /> expression to be formatted.</param>
<param name="NamedFormat">Optional. Numeric value that indicates the date/time format used. If omitted, <see langword="DateFormat.GeneralDate" /> is used.</param>
<summary>Returns a string expression representing a date/time value.</summary>
<returns>Returns a string expression representing a date/time value.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The `Date` data type always contains both date and time information. For purposes of type conversion, Visual Basic considers 1/1/1 (January 1 of the year 1) to be a neutral value for the date, and 00:00:00 (midnight) to be a neutral value for the time. If you format a `Date` value as a date/time string, `FormatDateTime` does not include neutral values in the resulting string. For example, if you convert #1/1/0001 9:30:00# to a string, the result is "9:30:00 AM"; the date information is suppressed. However, the date information is still present in the original `Date` value and can be recovered with functions such as `DatePart`.
> [!NOTE]
> If you pass the `Expression` argument as a `String` literal, `FormatDateTime` interprets it according to the <xref:System.Globalization.CultureInfo.CurrentCulture%2A> setting of your application. However, if you pass it as a `Date` literal, use the format #mm/dd/yyyy#, because `FormatDateTime` always interprets a `Date` literal according to the English (US) culture. This is necessary because, if an application is developed and coded using `Date` literals from one culture, but is then executed on a platform with a different culture, the `Date` literals could be parsed incorrectly.
The `NamedFormat` argument has the following settings.
|Constant|Description|
|-|-|
|`DateFormat.GeneralDate`|Display a date and/or time. Display a date part as a short date. If there is a time part, display it as a long time. If present, both parts display.|
|`DateFormat.LongDate`|Display a date using the long date format specified in your computer's regional settings.|
|`DateFormat.ShortDate`|Display a date using the short date format specified in your computer's regional settings.|
|`DateFormat.LongTime`|Display a time using the time format specified in your computer's regional settings.|
|`DateFormat.ShortTime`|Display a time using the 24-hour format (hh:mm).|
## Examples
This example demonstrates the use of the `FormatDateTime` function.
[!code-vb[VbVbalrStrings#3](~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrStrings/VB/Class1.vb#3)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">
<paramref name="NamedFormat" /> setting is not valid.</exception>
<altmember cref="M:Microsoft.VisualBasic.Strings.Format(System.Object,System.String)" />
<altmember cref="M:Microsoft.VisualBasic.Strings.FormatCurrency(System.Object,System.Int32,Microsoft.VisualBasic.TriState,Microsoft.VisualBasic.TriState,Microsoft.VisualBasic.TriState)" />
<altmember cref="M:Microsoft.VisualBasic.Strings.FormatNumber(System.Object,System.Int32,Microsoft.VisualBasic.TriState,Microsoft.VisualBasic.TriState,Microsoft.VisualBasic.TriState)" />
<altmember cref="M:Microsoft.VisualBasic.Strings.FormatPercent(System.Object,System.Int32,Microsoft.VisualBasic.TriState,Microsoft.VisualBasic.TriState,Microsoft.VisualBasic.TriState)" />
<altmember cref="T:System.ArgumentException" />
<altmember cref="M:Microsoft.VisualBasic.DateAndTime.DatePart(Microsoft.VisualBasic.DateInterval,System.DateTime,Microsoft.VisualBasic.FirstDayOfWeek,Microsoft.VisualBasic.FirstWeekOfYear)" />
<related type="Article" href="~/docs/visual-basic/language-reference/keywords/string-manipulation-summary.md">String Manipulation Summary</related>
</Docs>
</Member>
<Member MemberName="FormatNumber">
<MemberSignature Language="C#" Value="public static string FormatNumber (object Expression, int NumDigitsAfterDecimal = -1, Microsoft.VisualBasic.TriState IncludeLeadingDigit = Microsoft.VisualBasic.TriState.UseDefault, Microsoft.VisualBasic.TriState UseParensForNegativeNumbers = Microsoft.VisualBasic.TriState.UseDefault, Microsoft.VisualBasic.TriState GroupDigits = Microsoft.VisualBasic.TriState.UseDefault);" />
<MemberSignature Language="ILAsm" Value=".method public static string FormatNumber(object Expression, int32 NumDigitsAfterDecimal, valuetype Microsoft.VisualBasic.TriState IncludeLeadingDigit, valuetype Microsoft.VisualBasic.TriState UseParensForNegativeNumbers, valuetype Microsoft.VisualBasic.TriState GroupDigits) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.VisualBasic.Strings.FormatNumber(System.Object,System.Int32,Microsoft.VisualBasic.TriState,Microsoft.VisualBasic.TriState,Microsoft.VisualBasic.TriState)" />
<MemberSignature Language="VB.NET" Value="Public Function FormatNumber (Expression As Object, Optional NumDigitsAfterDecimal As Integer = -1, Optional IncludeLeadingDigit As TriState = Microsoft.VisualBasic.TriState.UseDefault, Optional UseParensForNegativeNumbers As TriState = Microsoft.VisualBasic.TriState.UseDefault, Optional GroupDigits As TriState = Microsoft.VisualBasic.TriState.UseDefault) As String" />
<MemberSignature Language="F#" Value="static member FormatNumber : obj * int * Microsoft.VisualBasic.TriState * Microsoft.VisualBasic.TriState * Microsoft.VisualBasic.TriState -> string" Usage="Microsoft.VisualBasic.Strings.FormatNumber (Expression, NumDigitsAfterDecimal, IncludeLeadingDigit, UseParensForNegativeNumbers, GroupDigits)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>7.0.5000.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="Expression" Type="System.Object" />
<Parameter Name="NumDigitsAfterDecimal" Type="System.Int32" />
<Parameter Name="IncludeLeadingDigit" Type="Microsoft.VisualBasic.TriState" />
<Parameter Name="UseParensForNegativeNumbers" Type="Microsoft.VisualBasic.TriState" />
<Parameter Name="GroupDigits" Type="Microsoft.VisualBasic.TriState" />
</Parameters>
<Docs>
<param name="Expression">Required. Expression to be formatted.</param>
<param name="NumDigitsAfterDecimal">Optional. Numeric value indicating how many places are displayed to the right of the decimal. The default value is -1, which indicates that the computer's regional settings are used.</param>
<param name="IncludeLeadingDigit">Optional. <see cref="T:Microsoft.VisualBasic.TriState" /> constant that indicates whether a leading 0 is displayed for fractional values. See "Settings" for values.</param>
<param name="UseParensForNegativeNumbers">Optional. <see cref="T:Microsoft.VisualBasic.TriState" /> constant that indicates whether to place negative values within parentheses. See "Settings" for values.</param>
<param name="GroupDigits">Optional. <see cref="T:Microsoft.VisualBasic.TriState" /> constant that indicates whether or not numbers are grouped using the group delimiter specified in the locale settings. See "Settings" for values.</param>
<summary>Returns an expression formatted as a number.</summary>
<returns>Returns an expression formatted as a number.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When one or more optional arguments are omitted the values for omitted arguments are provided by the locale settings.
> [!NOTE]
> All settings information comes from the locale of the application. By default, that will be the locale set in the control panel. However, it may be changed programmatically by using the .NET Framework.
The `IncludeLeadingDigit`, `UseParensForNegativeNumbers`, and `GroupDigits` arguments have the following settings.
|Constant|Description|
|-|-|
|`TriState.True`|True|
|`TriState.False`|False|
|`TriState.UseDefault`|The computer's regional settings|
## Examples
This example demonstrates the `FormatNumber` function.
[!code-vb[VbVbalrStrings#15](~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrStrings/VB/Class1.vb#15)]
]]></format>
</remarks>
<exception cref="T:System.InvalidCastException">Type is not numeric.</exception>
<altmember cref="M:Microsoft.VisualBasic.Strings.FormatCurrency(System.Object,System.Int32,Microsoft.VisualBasic.TriState,Microsoft.VisualBasic.TriState,Microsoft.VisualBasic.TriState)" />
<altmember cref="M:Microsoft.VisualBasic.Strings.FormatDateTime(System.DateTime,Microsoft.VisualBasic.DateFormat)" />
<altmember cref="M:Microsoft.VisualBasic.Strings.FormatPercent(System.Object,System.Int32,Microsoft.VisualBasic.TriState,Microsoft.VisualBasic.TriState,Microsoft.VisualBasic.TriState)" />
<altmember cref="T:Microsoft.VisualBasic.TriState" />
<altmember cref="T:System.InvalidCastException" />
<related type="Article" href="~/docs/visual-basic/language-reference/keywords/string-manipulation-summary.md">String Manipulation Summary</related>
</Docs>
</Member>
<Member MemberName="FormatPercent">
<MemberSignature Language="C#" Value="public static string FormatPercent (object Expression, int NumDigitsAfterDecimal = -1, Microsoft.VisualBasic.TriState IncludeLeadingDigit = Microsoft.VisualBasic.TriState.UseDefault, Microsoft.VisualBasic.TriState UseParensForNegativeNumbers = Microsoft.VisualBasic.TriState.UseDefault, Microsoft.VisualBasic.TriState GroupDigits = Microsoft.VisualBasic.TriState.UseDefault);" />
<MemberSignature Language="ILAsm" Value=".method public static string FormatPercent(object Expression, int32 NumDigitsAfterDecimal, valuetype Microsoft.VisualBasic.TriState IncludeLeadingDigit, valuetype Microsoft.VisualBasic.TriState UseParensForNegativeNumbers, valuetype Microsoft.VisualBasic.TriState GroupDigits) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.VisualBasic.Strings.FormatPercent(System.Object,System.Int32,Microsoft.VisualBasic.TriState,Microsoft.VisualBasic.TriState,Microsoft.VisualBasic.TriState)" />
<MemberSignature Language="VB.NET" Value="Public Function FormatPercent (Expression As Object, Optional NumDigitsAfterDecimal As Integer = -1, Optional IncludeLeadingDigit As TriState = Microsoft.VisualBasic.TriState.UseDefault, Optional UseParensForNegativeNumbers As TriState = Microsoft.VisualBasic.TriState.UseDefault, Optional GroupDigits As TriState = Microsoft.VisualBasic.TriState.UseDefault) As String" />
<MemberSignature Language="F#" Value="static member FormatPercent : obj * int * Microsoft.VisualBasic.TriState * Microsoft.VisualBasic.TriState * Microsoft.VisualBasic.TriState -> string" Usage="Microsoft.VisualBasic.Strings.FormatPercent (Expression, NumDigitsAfterDecimal, IncludeLeadingDigit, UseParensForNegativeNumbers, GroupDigits)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>7.0.5000.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="Expression" Type="System.Object" />
<Parameter Name="NumDigitsAfterDecimal" Type="System.Int32" />
<Parameter Name="IncludeLeadingDigit" Type="Microsoft.VisualBasic.TriState" />
<Parameter Name="UseParensForNegativeNumbers" Type="Microsoft.VisualBasic.TriState" />
<Parameter Name="GroupDigits" Type="Microsoft.VisualBasic.TriState" />
</Parameters>
<Docs>
<param name="Expression">Required. Expression to be formatted.</param>
<param name="NumDigitsAfterDecimal">Optional. Numeric value indicating how many places to the right of the decimal are displayed. Default value is -1, which indicates that the locale settings are used.</param>
<param name="IncludeLeadingDigit">Optional. <see cref="T:Microsoft.VisualBasic.TriState" /> constant that indicates whether or not a leading zero displays for fractional values. See "Settings" for values.</param>
<param name="UseParensForNegativeNumbers">Optional. <see cref="T:Microsoft.VisualBasic.TriState" /> constant that indicates whether or not to place negative values within parentheses. See "Settings" for values.</param>
<param name="GroupDigits">Optional. <see cref="T:Microsoft.VisualBasic.TriState" /> constant that indicates whether or not numbers are grouped using the group delimiter specified in the locale settings. See "Settings" for values.</param>
<summary>Returns an expression formatted as a percentage (that is, multiplied by 100) with a trailing % character.</summary>
<returns>Returns an expression formatted as a percentage (that is, multiplied by 100) with a trailing % character.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When one or more optional arguments are omitted, the values for omitted arguments are provided by the locale settings.
> [!NOTE]
> All settings information comes from the locale of the application. By default, that will be the locale set in the control panel. However, it may be changed programmatically by using the .NET Framework.
The `IncludeLeadingDigit`, `UseParensForNegativeNumbers`, and `GroupDigits` arguments have the following settings.
|Constant|Description|
|-|-|
|`TriState.True`|True|
|`TriState.False`|False|
|`TriState.Default`|The computer's regional settings|
## Examples
This example illustrates the use of the `FormatPercent` function.
[!code-vb[VbVbalrStrings#28](~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrStrings/VB/Class1.vb#28)]
]]></format>
</remarks>
<exception cref="T:System.InvalidCastException">Type is not numeric.</exception>
<altmember cref="M:Microsoft.VisualBasic.Strings.FormatCurrency(System.Object,System.Int32,Microsoft.VisualBasic.TriState,Microsoft.VisualBasic.TriState,Microsoft.VisualBasic.TriState)" />
<altmember cref="M:Microsoft.VisualBasic.Strings.FormatDateTime(System.DateTime,Microsoft.VisualBasic.DateFormat)" />
<altmember cref="M:Microsoft.VisualBasic.Strings.FormatNumber(System.Object,System.Int32,Microsoft.VisualBasic.TriState,Microsoft.VisualBasic.TriState,Microsoft.VisualBasic.TriState)" />