• Saves Valuable Time
  • Trusted Accuracy since 2004
  • 15-Day Money-Back Guarantee

C# Equivalent to VB String Functions

The VB string members having direct .NET equivalents include Asc, Chr, Format, GetChar, InStr, LCase, Left, Len, LTrim, Mid, Replace, Right, RTrim, Space, Split, StrComp, Trim, and UCase.  Try the Free Edition of Instant C# for details.  In general, you need to be aware that the VB methods usually yield 1-based results, or expect 1-based arguments, while the .NET methods are always 0-based.

Note that the VB functions perform null checks on the strings, but the System.String methods do not - Instant C# offers an option to convert to 'strict' equivalents of VB string functions.

For example, the following VB code:
y = Mid(y, 3)
Can be converted to the following C# code (without the 'strict' conversion option):
y = y.Substring(2);

Overview of VB to .NET string method mappings:

Use Instant C# to convert from VB.NET to C#.     

Additional resource: VB.NET and C# Equivalents

Copyright © 2004 – 2021 Tangible Software Solutions, Inc.