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 / April 2006

Tip: Looking for answers? Try searching our database.

Regular expressions - matching strings

Thread view: 
sconeek@gmail.com - 04 Apr 2006 06:19 GMT
hi all,
i am working on a java application. i have this table which contains
name fields and all of them start with a N-. so the table contains
records like N-TomSmith, N-PeterSay etc.
now from within my java class i am trying to read these records.
now the main bit, how should i specify my class to pick up all records
which start with N-.
am trying to read about reg expressions in the meantime. i hope
somebody can help me.
thanks.
Knute Johnson - 04 Apr 2006 06:34 GMT
> hi all,
> i am working on a java application. i have this table which contains
[quoted text clipped - 6 lines]
> somebody can help me.
> thanks.

Have you split them into strings?  If so you can check the first
characters with String.startsWith().

Signature

Knute Johnson
email s/nospam/knute/

Roedy Green - 04 Apr 2006 15:48 GMT
>i am working on a java application. i have this table which contains
>name fields and all of them start with a N-. so the table contains
[quoted text clipped - 4 lines]
>am trying to read about reg expressions in the meantime. i hope
>somebody can help me.

field.charAt(0) == 'N' && field.charAt(1) == '-'
or
field.startsWith( "N-" )
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.



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



©2008 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.