Microsoft.VisualBasic namespace Strings module StrConv functions have uppercase/lowercase, full-width/half-width, Simplified Chinese/traditional conversion functions, String conversion should be said to be VB.net's strong point, is this: vb.net direct StrConv function is OK, C # version of the need to add a reference Microsoft.VisualBasic.dll in the project, and then you can in C # The StrConv function of vb.net is used directly in the program.
Adding reference Microsoft.VisualBasic.dll to a C # project, you can use the rich functions in vb.net 1//command-line compilation directly in a C # program: Csc/r:microsoft.visualbasic.dll Test.cs
If you are using the Visual Studio. NET IDE, add a reference to your project in the following ways:
Open [Solution Explorer], right-click the project name, select [Add Reference],
Select the Microsoft Visual Basic. NET Runtime component from the list.
Using Microsoft.VisualBasic;
Class Test
{
static void Main ()
{
string s = "blog Park-defifind";
System.Console.WriteLine (s);
s = Strings.strconv (s, vbstrconv.wide, 0); Half angle turn full angle
s = Strings.strconv (s, VbStrConv.TraditionalChinese, 0); Simplified to Traditional
System.Console.WriteLine (s);
s = Strings.strconv (s, vbstrconv.propercase, 0); Capitalize first letter
s = Strings.strconv (s, vbstrconv.narrow, 0); Full angle turning half angle
s = Strings.strconv (s, VbStrConv.SimplifiedChinese, 0); Traditional to Simplified
System.Console.WriteLine (s);
}
C # Full-width half-width conversion output Solution