.Net equal to the VB Right string function

  • Thread starter Thread starter moondaddy
  • Start date Start date
M

moondaddy

I looked at the string functions in .net and didnt see anything thats
similar to the old vb6 Right string function. Is there another .net way to
do this? Here's my suto code for what I'm trying to do:

sOldString = "12345678"
sNewString = Right(sOldString,4)
'sNewString should be "5678"

Thanks.
 
* "moondaddy said:
I looked at the string functions in .net and didnt see anything thats
similar to the old vb6 Right string function. Is there another .net way to
do this? Here's my suto code for what I'm trying to do:

You can use the string's 'Substring' method, or, you can still use
'Strings.Right'.
 
....Or..
Try adding (importing) Microsoft.VisualBasic namespac
into top of your clas
That is the way for using good-old Right() functio
Something like this

Imports Microsoft.VisualBasi

Public Class Some_Clas
Private Sub Some_Sub(
Dim strSome As Strin

sSome = "1234
Right(sSome,2) 'and the output is 123
End Su
End Clas
...
You can find a lot (maybe the whole) of old vb6 functions
 
moondaddy said:
I looked at the string functions in .net and didnt see anything
thats similar to the old vb6 Right string function. Is there another
.net way to do this? Here's my suto code for what I'm trying to
do:

sOldString = "12345678"
sNewString = Right(sOldString,4)
'sNewString should be "5678"


It's also a part of VB.NET:

sNewString = Microsoft.VisualBasic.Strings.Right(sOldString,4)


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
Back
Top