Trying to get Left or Right Values

G

gibboda

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
 
S

su_dang

gibboda said:
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
 
O

Oliver Wong

gibboda said:
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
 
T

Thomas Hawtin

gibboda said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,054
Latest member
LucyCarper

Latest Threads

Top