java - Skip Rest of the string if found character -
hi have next string output server.
eyj0exaioijkv1qilcjhbgcioijiuzi1nij9.eyjzy29wzsi6innjb3blomnsawvuddppbmnvbwluzz9jbgllbnroyw1lpwplbm55ihnjb3blomnsawvuddpvdxrnb2luzz9hchbtawq9qva2ymi2ndi1zme3mtu3mzdmyjfmytllmji1mdk4njdlmszhchbqyxjhbxm9jmnsawvude5hbwu9amvubnkilcjpc3mioijbqzi4ymnjyzc0nzq4zdaznzrmnzg5zjgyn2u0ogmzodnjiiwizxhwijoxmzyxndm0ody1fq.q17gvt8itdmximk2rps5bhwtsfbk3l-susx2jxju3wk <!-- hosting24 analytics code --> <script type="text/javascript" src="http://stats.hosting24.com/count.php"></script> <!-- end of analytics code -->
i want skip html part of string ie want
eyj0exaioijkv1qilcjhbgcioijiuzi1nij9.eyjzy29wzsi6innjb3blomnsawvuddppbmnvbwluzz9jbgllbnroyw1lpwplbm55ihnjb3blomnsawvuddpvdxrnb2luzz9hchbtawq9qva2ymi2ndi1zme3mtu3mzdmyjfmytllmji1mdk4njdlmszhchbqyxjhbxm9jmnsawvude5hbwu9amvubnkilcjpc3mioijbqzi4ymnjyzc0nzq4zdaznzrmnzg5zjgyn2u0ogmzodnjiiwizxhwijoxmzyxndm0ody1fq.q17gvt8itdmximk2rps5bhwtsfbk3l-susx2jxju3wk
and want remove next string
<!-- hosting24 analytics code --> <script type="text/javascript" src="http://stats.hosting24.com/count.php"></script> <!-- end of analytics code -->
what method should utilize observe <!--
, skip rest of string?
if analytics comment you're trying remove @ end of string, like:
string s = "..."; int pos = s.indexof("<!-- hosting24 analytics code -->"); if (pos >= 0) { s = s.substring(0, pos); } // go on working s
if it's somewhere in middle of string, may need additional indexof() calls find start , end of want remove. note method returns -1 when substring isn't found.
s.substring(a, b);
will homecoming subsequence of characters in s starts @ position , ends @ position b - 1 (if a==b resulting string empty).
java string trim
No comments:
Post a Comment