Note that there are some explanatory texts on larger screens.

plurals
  1. POGet word part from a variable String
    primarykey
    data
    text
    <p>I've been implementing an application to retrieve a word inside a incoming String parameter, this String parameter can vary since it is an URL, but the pattern for almost all the incoming url's is the same. For instance I could have:</p> <pre><code>GET /com.myapplication.v4.ws.monitoring.ModuleSystemMonitor HTTP/1.1 </code></pre> <p>or</p> <pre><code>GET /com.myapplication.filesystem.ws.ModuleFileSystem/getIdFolders/jsonp?idFolder=idFis1&amp;callback=__gwt_jsonp__.P0.onSuccess&amp;failureCallback=__gwt_jsonp__.P0.onFailure HTTP/1.1 </code></pre> <p>So in any case, I want to extract the word that starts with Module, for example, for the first incoming parameter I want to get: ModuleSystemMonitor. And for the second one I want to get the word: ModuleFileSystem.</p> <p>This is the requirement, I'm not allowed to do anything else but this: just a method that receives a line and try to extract the words I mentioned: ModuleSystemMonitor and ModuleFileSystem.</p> <p>I've been thinkng of using <code>StringTokenizer</code> class or <code>String#split</code> method, but I'm not sure if they are the best option. I tried and it is easy to get the word begins with Module using indexOf, but how to cut the word if from some cases it comes with a white space like the first sample or it comes with a "/" (slash) in the second. I know I can make an "if" statement and cut it when it is white space or it is slash but I wonder to know if there is another way that could be more dynamic.</p> <p>Thanks in advance for your time and help. Best regards.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload