RE: VB.Net Counterpart to RIGHT$ and LEFT$ vb6 functions???
am 10.10.2007 01:51:01 von DavidAnton
For Left, a fairly direct use of the string SubString method will do.
e.g., Left(y, 2) becomes y.Substring(0, 2)
For Right, it's only slightly more complex.
e.g., Right(y, 2) becomes y.Substring(y.Length - 2)
--
http://www.tangiblesoftwaresolutions.com
C++ to C#
C++ to VB
C++ to Java
C++ to C++/CLI
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: convert VB or C# to C++/CLI
"Alan Mailer" wrote:
> Could someone tell me what the VB.Net counterparts are to the commands
> in VB6 which used to allow me to return only the rightmost or leftmost
> parts of a string?
>
> Thanks in advance.
>
Re: VB.Net Counterpart to RIGHT$ and LEFT$ vb6 functions???
am 10.10.2007 12:12:49 von Andrew Morton
Alan Mailer wrote:
> Could someone tell me what the VB.Net counterparts are to the commands
> in VB6 which used to allow me to return only the rightmost or leftmost
> parts of a string?
If you use
Imports VB=Microsoft.VisualBasic
then you can use VB.Left() and VB.Right() on strings.
The VB=... makes VB an alias of Microsoft.VisualBasic so you don't have to
keep typing it.
If you use String.Substring from the .NET framework then you should check if
the string is not Nothing first, and that you aren't trying to get a
substring that is outside the ends of the string.
Andrew