Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think it is not possible to parse it but we can use logic to get data from that string but format should same for ever</p> <pre><code>import net.rim.device.api.ui.UiApplication; import net.rim.device.api.ui.component.LabelField; import net.rim.device.api.ui.container.MainScreen; public class StartUp extends UiApplication{ public static void main(String[] args) { StartUp start=new StartUp(); start.enterEventDispatcher(); } public StartUp() { pushScreen(new simple()); } } class simple extends MainScreen { LabelField labl; public simple() { String str="\ndocument.write('&lt;table&gt;&lt;tr&gt;&lt;td&gt;Hello, visitor from: &lt;strong&gt; Takatsuki, Japan&lt;/strong&gt;');document.write('&lt;img src=\'http://www.ipaddresslocation.org/flags/jp.png\'&gt;&lt;/td&gt;&lt;/tr&gt;');document.write('&lt;tr&gt;&lt;td&gt;Your Country Code: &lt;b&gt;JP&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;');document.write('&lt;tr&gt;&lt;td&gt;Your IP State: &lt;b&gt;Osaka&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;');document.write('&lt;tr&gt;&lt;td&gt;Your IP Address: &lt;b&gt;202.213.220.66&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;');document.write('&lt;tr&gt;&lt;td&gt;Your Hostname: &lt;b&gt;ns.isb.co.jp&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;');document.write('&lt;tr&gt;&lt;td&gt;Your ISP: &lt;b&gt;So-net Entertainment Corporation&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;');document.write('&lt;tr&gt;&lt;td&gt;Your Organization: &lt;b&gt;ISB CORP.&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;');"; str=str.substring(str.indexOf("document.write")); String arr[]=split(str, "document.write('"); String s=""; int len=arr.length; for(int i=0;i&lt;len;i++){ if(i==0){ s=arr[i]; if(s.indexOf("&lt;strong&gt;")!=-1 &amp;&amp; s.indexOf("&lt;/strong&gt;")!=-1 ){ int sx=s.indexOf("&lt;strong&gt;")+8; int dx=s.indexOf("&lt;/strong&gt;"); System.out.println(s.substring(sx,dx)); labl=new LabelField(s.substring(sx,dx)); add(labl); } }else if(i==1){ s=arr[i]; if(s.indexOf("img src='")!=-1 &amp;&amp; s.indexOf("'&gt;")!=-1 ){ int sx=s.indexOf("'")+1; int dx=s.indexOf("'&gt;"); System.out.println(s.substring(sx,dx)); labl=new LabelField(s.substring(sx,dx)); add(labl); } } else{ if(arr[i].indexOf("&lt;b&gt;")!=-1 &amp;&amp; arr[i].indexOf("&lt;/b&gt;")!=-1 ){ int sx=arr[i].indexOf("&lt;b&gt;")+3; int dx=arr[i].indexOf("&lt;/b&gt;"); System.out.println(arr[i].substring(sx,dx)); labl=new LabelField(arr[i].substring(sx,dx)); add(labl); } } } } public static String[] split(String strString, String strDelimiter) { int iOccurrences = 0; int iIndexOfInnerString = 0; int iIndexOfDelimiter = 0; int iCounter = 0; // Check for null input strings. if (strString == null) { throw new NullPointerException("Input string cannot be null."); } // Check for null or empty delimiter // strings. if (strDelimiter.length() &lt;= 0 || strDelimiter == null) { throw new NullPointerException("Delimeter cannot be null or empty."); } // If strString begins with delimiter // then remove it in // order // to comply with the desired format. if (strString.startsWith(strDelimiter)) { strString = strString.substring(strDelimiter.length()); } // If strString does not end with the // delimiter then add it // to the string in order to comply with // the desired format. if (!strString.endsWith(strDelimiter)) { strString += strDelimiter; } // Count occurrences of the delimiter in // the string. // Occurrences should be the same amount // of inner strings. while((iIndexOfDelimiter= strString.indexOf(strDelimiter,iIndexOfInnerString))!=-1) { iOccurrences += 1; iIndexOfInnerString = iIndexOfDelimiter + strDelimiter.length(); } // Declare the array with the correct // size. String[] strArray = new String[iOccurrences]; // Reset the indices. iIndexOfInnerString = 0; iIndexOfDelimiter = 0; // Walk across the string again and this // time add the // strings to the array. while((iIndexOfDelimiter= strString.indexOf(strDelimiter,iIndexOfInnerString))!=-1) { // Add string to // array. strArray[iCounter] = strString.substring(iIndexOfInnerString, iIndexOfDelimiter); // Increment the // index to the next // character after // the next // delimiter. iIndexOfInnerString = iIndexOfDelimiter + strDelimiter.length(); // Inc the counter. iCounter += 1; } return strArray; } } </code></pre> <p>you will get output as following image <img src="https://i.stack.imgur.com/4Ktig.png" alt="Image"></p>
 

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