Solved

how to parse a String ?

Posted on 2004-04-28
2
195 Views
Last Modified: 2010-04-01
Hello,
I would like to parse this String -
dept/software/eng/bob/
 
or
dept/software/eng/


And the result ie the output should only be -
test

It would be great if I can use some taglib to get the last element ie-
bob or eng


Or if you can help me with some Java code to do this please


Thanks
awaiting a response!
0
Comment
Question by:sdesar
2 Comments
 
LVL 7

Accepted Solution

by:
mark-b earned 20 total points
ID: 10943928
String s = "dept/software/eng/bob/";
            
StringTokenizer st = new StringTokenizer( s, "/" );
String last=null;
            
while (st.hasMoreTokens() ) last = st.nextToken();
            
System.out.println( "Last=" + last );
0
 

Author Comment

by:sdesar
ID: 10944050
Awesome !
Thanks
here are the excellent points
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifi…
In this step by step tutorial with screenshots, we will show you HOW TO: Enable SSH Remote Access on a VMware vSphere Hypervisor 6.5 (ESXi 6.5). This is important if you need to enable SSH remote access for additional troubleshooting of the ESXi hos…
This video discusses moving either the default database or any database to a new volume.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

706 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now