Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

parse a string using a delimeter in xml

Posted on 2011-04-27
3
Medium Priority
?
441 Views
Last Modified: 2012-05-11
Hello,  

I'm a newbie to web programming and I'm sure glad I found this site.

I have a string which I want to parse into 4 segments using a dash "-" as a delimeter.  Here is a sample data element:  ItemUpdate-HOSP-99998-C.  My data is contained in an xml string:  <!qry_wfw_WORK_TITLE>.  I know how to parse the xml string using a substring function; example <!qry_wfw_WORK_TITLE.substr(16, 5)> returns "99998".  How would I split the data into 4 different fields using a dash as a delimeter?  In other tools I would use a split function such as lsplt([field name], 4, "-", 3) where the function uses the delimeter "-" and returns the 3rd segment.
0
Comment
Question by:jrbledsoe001
3 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 35483388
Hi

It is not clear to me what language you are using and where.

Is it inside XSL? because your syntax does not seems to match anything I have seen - like this for example


http://www.xml.com/lpt/a/962
0
 
LVL 36

Accepted Solution

by:
Miguel Oz earned 2000 total points
ID: 35487837
Use string split method:
http://www.dotnetperls.com/string-split
string data = "qry_wfw_WORK_TITLE"; //your xml data to split
string[] words = data.Split('_');
//words[3] will contain title.
0
 

Author Comment

by:jrbledsoe001
ID: 35493369
Hello mas oz2003!  I saw your reference to that url when I was researching my question.  Your comment information was all that I needed to understand how to use the string split method.  
I think this split method will work perfectly.  Thanks for providing an answer to my question!!!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question