Trying to get Left or Right Values

Discussion in 'Java' started by gibboda, Oct 24, 2006.

  1. gibboda

    gibboda Guest

    I am trying to duplicate an if statement that was done in our VB
    program in Java Program. I have search the groups and the web trying
    to get an understanding of doing it in java but have failed.

    The VB statement is:

    If Left(value,4) = "LIST" Then

    (Do some programming logic)

    End if

    Thank you for your advice and any input where to look for information.

    DG
     
    gibboda, Oct 24, 2006
    #1
    1. Advertising

  2. gibboda

    Guest

    gibboda wrote:
    > I am trying to duplicate an if statement that was done in our VB
    > program in Java Program. I have search the groups and the web trying
    > to get an understanding of doing it in java but have failed.
    >
    > The VB statement is:
    >
    > If Left(value,4) = "LIST" Then
    >
    > (Do some programming logic)
    >
    > End if
    >
    > Thank you for your advice and any input where to look for information.
    >
    > DG


    If value is a string then you can use
    value.substring(0, 4)
    to extract the leftmost 4 characters
     
    , Oct 24, 2006
    #2
    1. Advertising

  3. gibboda

    Oliver Wong Guest

    "gibboda" <> wrote in message
    news:...
    >I am trying to duplicate an if statement that was done in our VB
    > program in Java Program. I have search the groups and the web trying
    > to get an understanding of doing it in java but have failed.
    >
    > The VB statement is:
    >
    > If Left(value,4) = "LIST" Then
    >
    > (Do some programming logic)
    >
    > End if


    if (value.startsWith("LIST")) {
    //do some programming logic.
    }

    (and similarly with endsWith)

    >
    > Thank you for your advice and any input where to look for information.


    Look here for information: http://java.sun.com/j2se/1.5.0/docs/api/

    - Oliver
     
    Oliver Wong, Oct 24, 2006
    #3
  4. gibboda wrote:
    > I am trying to duplicate an if statement that was done in our VB
    > program in Java Program. I have search the groups and the web trying
    > to get an understanding of doing it in java but have failed.
    >
    > The VB statement is:
    >
    > If Left(value,4) = "LIST" Then
    >
    > (Do some programming logic)
    >
    > End if


    if (value.startsWith("LIST")) {
    ...
    }


    > Thank you for your advice and any input where to look for information.


    I suggest looking at the API docs:

    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html

    Tom Hawtin
     
    Thomas Hawtin, Oct 24, 2006
    #4
  5. gibboda

    gibboda Guest

    wrote:
    > gibboda wrote:
    > > I am trying to duplicate an if statement that was done in our VB
    > > program in Java Program. I have search the groups and the web trying
    > > to get an understanding of doing it in java but have failed.
    > >
    > > The VB statement is:
    > >
    > > If Left(value,4) = "LIST" Then
    > >
    > > (Do some programming logic)
    > >
    > > End if
    > >
    > > Thank you for your advice and any input where to look for information.
    > >
    > > DG

    >
    > If value is a string then you can use
    > value.substring(0, 4)
    > to extract the leftmost 4 characters


    Thank you.
     
    gibboda, Oct 24, 2006
    #5
  6. gibboda

    gibboda Guest

    Oliver Wong wrote:
    > "gibboda" <> wrote in message
    > news:...
    > >I am trying to duplicate an if statement that was done in our VB
    > > program in Java Program. I have search the groups and the web trying
    > > to get an understanding of doing it in java but have failed.
    > >
    > > The VB statement is:
    > >
    > > If Left(value,4) = "LIST" Then
    > >
    > > (Do some programming logic)
    > >
    > > End if

    >
    > if (value.startsWith("LIST")) {
    > //do some programming logic.
    > }
    >
    > (and similarly with endsWith)
    >
    > >
    > > Thank you for your advice and any input where to look for information.

    >
    > Look here for information: http://java.sun.com/j2se/1.5.0/docs/api/
    >
    > - Oliver


    Thank you,
    DG
     
    gibboda, Oct 24, 2006
    #6
  7. gibboda

    gibboda Guest

    Thomas Hawtin wrote:
    > gibboda wrote:
    > > I am trying to duplicate an if statement that was done in our VB
    > > program in Java Program. I have search the groups and the web trying
    > > to get an understanding of doing it in java but have failed.
    > >
    > > The VB statement is:
    > >
    > > If Left(value,4) = "LIST" Then
    > >
    > > (Do some programming logic)
    > >
    > > End if

    >
    > if (value.startsWith("LIST")) {
    > ...
    > }
    >
    >
    > > Thank you for your advice and any input where to look for information.

    >
    > I suggest looking at the API docs:
    >
    > http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html
    >
    > Tom Hawtin


    Thank you,
    DG
     
    gibboda, Oct 24, 2006
    #7
    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. UJ
    Replies:
    1
    Views:
    620
    John Timney \(MVP\)
    Nov 1, 2006
  2. =?Utf-8?B?QmlzaG95?=
    Replies:
    0
    Views:
    1,077
    =?Utf-8?B?QmlzaG95?=
    Dec 28, 2006
  3. Leon
    Replies:
    3
    Views:
    198
    TaeHo Yoo
    Nov 26, 2004
  4. Oran
    Replies:
    2
    Views:
    626
  5. mariomueller
    Replies:
    2
    Views:
    583
    mariomueller
    Aug 24, 2006
Loading...

Share This Page