Right(string)

Discussion in 'ASP .Net' started by Brian Shannon, Aug 3, 2004.

  1. Is there a VB.NET function to find the right most characters of a string
    similiar to Microsoft.VisualBasic.Right?

    I am currently using the below code to find the right most characters and am
    wondering if there is a more efficient or better way to do the same.

    dim x as string
    dime y as string
    dim lastIndexof as stirng
    x = New StringBuilder(WhereFunction)y = x.Length

    lastIndexof = x.ToString.LastIndexOf(" ")

    If y = lastIndexof Then

    y = y

    End If
    Brian Shannon, Aug 3, 2004
    #1
    1. Advertising

  2. Brian Shannon

    Raterus Guest

    Right() still can be used, infact you don't even need to be using VB.net

    Microsoft.VisualBasic.Right("blah", 2)

    "Brian Shannon" <> wrote in message news:...
    > Is there a VB.NET function to find the right most characters of a string
    > similiar to Microsoft.VisualBasic.Right?
    >
    > I am currently using the below code to find the right most characters and am
    > wondering if there is a more efficient or better way to do the same.
    >
    > dim x as string
    > dime y as string
    > dim lastIndexof as stirng
    > x = New StringBuilder(WhereFunction)y = x.Length
    >
    > lastIndexof = x.ToString.LastIndexOf(" ")
    >
    > If y = lastIndexof Then
    >
    > y = y
    >
    > End If
    >
    >
    Raterus, Aug 3, 2004
    #2
    1. Advertising

  3. Thanks for the quick reply. I know that Microsoft.VisualBasic.Right can
    still be used but I just assumed there is a more effecient way of doing it
    with with the string functions or stringbuilder class.

    Just curious if there is another way?

    Thanks Raterus
    "Raterus" <> wrote in message
    news:...
    Right() still can be used, infact you don't even need to be using VB.net

    Microsoft.VisualBasic.Right("blah", 2)

    "Brian Shannon" <> wrote in message
    news:...
    > Is there a VB.NET function to find the right most characters of a string
    > similiar to Microsoft.VisualBasic.Right?
    >
    > I am currently using the below code to find the right most characters and

    am
    > wondering if there is a more efficient or better way to do the same.
    >
    > dim x as string
    > dime y as string
    > dim lastIndexof as stirng
    > x = New StringBuilder(WhereFunction)y = x.Length
    >
    > lastIndexof = x.ToString.LastIndexOf(" ")
    >
    > If y = lastIndexof Then
    >
    > y = y
    >
    > End If
    >
    >
    Brian Shannon, Aug 3, 2004
    #3
  4. Brian Shannon

    Raterus Guest

    You can basically achieve the same effect using substring

    Dim blah as string = "here is some string"
    Dim newstring as string = blah.Substring(blah.Length - 5)

    At this point newstring = "tring"


    "Brian Shannon" <> wrote in message news:...
    > Thanks for the quick reply. I know that Microsoft.VisualBasic.Right can
    > still be used but I just assumed there is a more effecient way of doing it
    > with with the string functions or stringbuilder class.
    >
    > Just curious if there is another way?
    >
    > Thanks Raterus
    > "Raterus" <> wrote in message
    > news:...
    > Right() still can be used, infact you don't even need to be using VB.net
    >
    > Microsoft.VisualBasic.Right("blah", 2)
    >
    > "Brian Shannon" <> wrote in message
    > news:...
    > > Is there a VB.NET function to find the right most characters of a string
    > > similiar to Microsoft.VisualBasic.Right?
    > >
    > > I am currently using the below code to find the right most characters and

    > am
    > > wondering if there is a more efficient or better way to do the same.
    > >
    > > dim x as string
    > > dime y as string
    > > dim lastIndexof as stirng
    > > x = New StringBuilder(WhereFunction)y = x.Length
    > >
    > > lastIndexof = x.ToString.LastIndexOf(" ")
    > >
    > > If y = lastIndexof Then
    > >
    > > y = y
    > >
    > > End If
    > >
    > >

    >
    >
    Raterus, Aug 3, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tom
    Replies:
    0
    Views:
    409
  2. =?Utf-8?B?QmlzaG95?=
    Replies:
    0
    Views:
    954
    =?Utf-8?B?QmlzaG95?=
    Dec 28, 2006
  3. Bogdan
    Replies:
    1
    Views:
    762
    Bogdan
    Jun 16, 2009
  4. Leon
    Replies:
    3
    Views:
    158
    TaeHo Yoo
    Nov 26, 2004
  5. Oran
    Replies:
    2
    Views:
    503
Loading...

Share This Page