Java String length & Unicode All In One
Java String length & Unicode All In One
emoji 组合
👨🏻💻 = 👨🏻🦱 + 💻
UTF-8 / UTF-16
public class HelloWorld {
public static void main(String []args) {
String s = "java";
System.out.println(s.length());
// Unicode length
System.out.println("Hello World".length());
System.out.println("✅".length());
System.out.println("👨🏻💻".length());
}
}
/*
4
11
1
7
*/
demos
- java
public class HelloWorld {
public static void main(String []args) {
System.out.println("👨🏻💻".length());
String emoji = "👨🏻💻";
for(int i=0; i< emoji.length(); i++){
char c = emoji.charAt(i);
System.out.println(c);
}
}
}
/*
7
?
?
?
?
?
?
*/
- js
// 四合一 emoji
const emoji = "👨🏻💻";
for (let char of emoji) {
console.log(`char =`, char);
}
// char = 👨
// char = 🏻
// char =
// char = 💻
java tutorials
https://www.runoob.com/java/java-tutorial.html
https://codegym.cc/quests/lectures
(🐞 反爬虫测试!打击盗版⚠️)如果你看到这个信息, 说明这是一篇剽窃的文章,请访问 https://www.cnblogs.com/xgqfrms/ 查看原创文章!
refs
java
REPL
https://www.runoob.com/try/runcode.php?filename=HelloWorld&type=java
https://juejin.cn/post/6844904036873814023
©xgqfrms 2012-2021
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/17082942.html
未经授权禁止转载,违者必究!