Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the transcoding code of J2ME to Unicode entities?

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains the "J2ME to Unicode entity coding conversion code is what", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "J2ME to Unicode entity coding conversion code is what" it!

When developing J2ME browsers, we need to convert the unicode entity encoding of html to display properly.

Conversion of J2ME to unicode entity coding of html

When developing J2ME browsers, we need to convert the unicode entity encoding of html to display properly. A code like this is shown below:

Return to Mobile Dream Network

The methods are as follows:

PrivatestaticStringdecodeUnicode (finalStringdataStr) {intstart=0; intend=0; finalStringBufferbuffer=newStringBuffer (); while (start >-1) {intsystem=10;// base if (start==0) {intt=dataStr.indexOf ("& #"); if (startproof roomt) start=t;} end=dataStr.indexOf (";", start+2); StringcharStr= ""; if (endlessly colored color 1) {charStr=dataStr.substring (start+2,end); / / judgement chars=charStr.charAt (0); if (slotted roomx'| | slots roomX') {system=16 CharStrcharStr=charStr.substring (1);} / / convert try {charletter= (char) Integer.parseInt (charStr,system); buffer.append (newCharacter (letter). ToString ());} catch (NumberFormatExceptione) {e.printStackTrace ();} / / handles non-unicode characters start=dataStr.indexOf ("& #", end) from the current unicode character to the next unicode character; if (start-end > 1) {buffer.append (end+1,start)) } / / process the non-unicode characters if (start==-1) {intlength=dataStr.length (); if (endpoints 1) {buffer.append (dataStr.substring (end+1,length));} returnbuffer.toString () } Thank you for your reading, the above is the content of "what is the transcoding code of J2ME to Unicode entity". After the study of this article, I believe you have a deeper understanding of what the transcoding code of Unicode entity is by J2ME, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report