This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Still really new to programming in general, However, my motto is if I can think it it is either being done or been done.
I work with an interface engine which uses java. A lot of the tools are in the development gui. Currently working with HL7.
We use a propeties file which contain the key prefix for a data look up.
The data I have been given is to do a look up for the value of field "A" + field "B"
So on the properties look up we would have key.trx.AB=DOCTYPE
I have created a variable to hold the value of the two concatenated fields and then place the value in the outgoing message.
example input A|B||||
There are two other additional values for the report header and I was wondering is it possible to break parse the value into 3 variables and add them to the orginal key lookup? Each document type could have 2 headers associated to it.
If AB=DOCTYPE,HEADER1,HEADER2 So the output would look like
Sorry for no code written and I would appreciate any guidance on were to start,I guess I am hoping to be able to create one variable and then parse it out to the appropriate fields instead of 3 differnt variables. I was not sure if it was possible to put a delimeter in the key look up and then do a substring of the variable to the additional fields.
So you are trying to parse / generate HL7 format using Java? I have only a very faint idea of what HL7 is (I remember someone mentioning it on the forums here before).
"However, my motto is if I can think it it is either being done or been done."
Indeed, it is already being done. Have you tried searching with Google for "Java HL7"? You're not the first person in the world who is trying to do something with HL7 in Java. Why not use one of the existing libraries or projects instead of trying to invent everything yourself?
Actually I am not trying to parse but perform string manipulation and need to set certain fields based on a look up to a properties file. So I was just curious if there was away based on the return to parse the data out instead of creating three separate key entries.
Jumped ahead a bit in the head first book and assumed I am working with some variation of either an array list,link list or hashmap.
I have a variable which holds the return of the look up and was not sure if there was away to parse it to differnt substrings, again read ahead a little further than I should but was thinking of the string tokenizer.
example var contains the following ABC,header1,header2
Ok, so is your question about parsing a string like "ABC,header1,header2" into parts delimited by commas? One of the easiest ways to do this is to use the split(...) method in class String. It takes a regular expression as an argument. Example:
You can also use StringTokenizer to parse a string. [ March 21, 2007: Message edited by: Jesper Young ]
Joined: Jan 12, 2007
Thank you very much, this is exactly what I was asking. Sorry for taking the long way to ask a question.