| Author |
program to extract the full string based on requirement
|
pavithra murthy
Ranch Hand
Joined: Feb 06, 2009
Posts: 53
|
|
HELLO ALL ,
I HAVE A FILE WHICH CONTAINS "MRN 09DE588004180289E0" as a value . the requirement is based on the entry of only MRN it should provide me the next 13 digit number . i have used a bufferedreader and reading through the file but in the condition it seems to fail .earlier i had given a while loop , then now have changed it to nested if statement but even then it is failing . could anyone help me out in this
|
 |
Scott Stromberg
Greenhorn
Joined: May 05, 2009
Posts: 2
|
|
Try this...
|
 |
Piet Verdriet
Ranch Hand
Joined: Feb 25, 2006
Posts: 266
|
|
Scott Stromberg wrote:Try this...
If 'line' truly was null, a NPE would be thrown.
Better do such checks like this:
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32620
|
|
Welcome to JavaRanch
There are several other java.lang.String methods, eg beginsWith and endsWith, which I think you might find useful.
|
 |
Piet Verdriet
Ranch Hand
Joined: Feb 25, 2006
Posts: 266
|
|
Campbell Ritchie wrote:Welcome to JavaRanch
...
Thanks Campbell, but I'm not that new here...
<crickets />
Okay, without the non-sense: welcome Scott!
;)
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
Campbell Ritchie wrote:beginsWith
startsWith
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32620
|
|
Thank you, Rob. I could say it was a way of persuading people to look in the API . . . or maybe I forgot the correct name!
And Piet Verdriet,
|
 |
 |
|
|
subject: program to extract the full string based on requirement
|
|
|