In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "java processing character function is what", in daily operation, I believe many people in java processing character function is what problem there is doubt, Xiaobian consulted all kinds of information, sorted out simple and easy to use operation method, hope to answer everyone "java processing character function is what" doubt helpful! Next, please follow the small series to learn together!
getBytes is a standard java string processing function, its role is to encode the characters represented by the string according to charset, and expressed in byte form.
Note: Strings are always stored in unicode encoding in Java memory.
2. newString Combines and identifies byte arrays according to charset encoding, and converts them to unicode storage.
3、setCharacterEncoding()
This function is used to set http requests or corresponding encodings.
examples
package com.test.bs; import java.io.UnsupportedEncodingException; public class UnicodeTest2 { public static void main (String[] args) {String a = "ha ha";try {byte[] gb2312 = a.getBytes ("GB2312");byte[] utf = a.getBytes("UTF-8");for (int i = 0; i < gb2312.length; i++) {System.out.print (gb2312[i]);}System.out.println(); for (int i = 0; i < utf.length; i++) {System.out.print(utf[i]);}System.out.println(); System.out.println (new String(gb2312));System.out.println (new String(utf));System.out.println (System.getProperty("file.encoding"));//System.out.println (new String(utf, "UTF-8"));System.out.println (new String(gb2312, "UTF-8"));} catch (UnsupportedEncodingException e) {e.printStackTrace();}} At this point, the study of "what is the function of java processing characters" is over, hoping to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.