In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
The content of this article mainly focuses on how javascript converts strings into binary. The content of the article is clear and well-organized. It is very suitable for beginners to learn and is worth reading. Interested friends can follow the editor to read together. I hope you can get something through this article!
Conversion methods: 1, the use of split () method to convert the string into a character array; 2, traversing the character array, the use of charCodeAt () and toString () method to convert each character element into a binary value; 3, the use of join () method to concatenate array elements, into a complete binary value.
The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.
Javascript converts a string to binary
Convert a string to a character array
Iterate through the character array, using charCodeAt () to convert each character element to an ascii code
Use toString (2) to convert ascii code elements to binary
Use join () to concatenate array elements to binary strings.
Implementation code:
Function strToBinary (str) {var result = []; var list = str.split (""); for (var itemositani)
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.