Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2006

Tip: Looking for answers? Try searching our database.

Trying to get Left or Right Values

Thread view: 
gibboda - 24 Oct 2006 14:54 GMT
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
su_dang@hotmail.com - 24 Oct 2006 15:29 GMT
> 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
[quoted text clipped - 11 lines]
>
> DG

If value is a string then you can use
value.substring(0, 4)
to extract the leftmost 4 characters
gibboda - 24 Oct 2006 18:49 GMT
> > 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
[quoted text clipped - 15 lines]
> value.substring(0, 4)
> to extract the leftmost 4 characters

Thank you.
Oliver Wong - 24 Oct 2006 16:06 GMT
>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
[quoted text clipped - 7 lines]
>
>   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
gibboda - 24 Oct 2006 18:49 GMT
> >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
[quoted text clipped - 19 lines]
>
>     - Oliver

Thank you,
DG
Thomas Hawtin - 24 Oct 2006 16:47 GMT
> 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
[quoted text clipped - 7 lines]
>
>    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
gibboda - 24 Oct 2006 18:50 GMT
> > 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
[quoted text clipped - 19 lines]
>
> Tom Hawtin

Thank you,
DG


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.