英文:
How to use (\u) with Variable in Java
问题
You can use \u
with a stored value in a variable like this:
你可以使用\u
与存储在变量中的值一起使用,如下所示:
英文:
Can I use \u with Stored Value in a variable ?
I want to awesome icon in android
when I pass a static value to textview like this
textView.setText('\uf13b'); i will get awesome icon
but when I want to restore the string from database like this (\uf13b) or (f13b) I will get it as a string!
how can I convert it to character
If I store (\uf13b) as a string in database I will get it as a string
答案1
得分: 3
如果你在字符串中有F13B,你可以用以下方式将其转换为等效的Unicode字符:
char awesomeChar = (char) Integer.parseInt("f13b", 16);
输出是
请注意,这是一个私用区字符,你需要使用特殊的图标字体才能看到你期望的图标。
英文:
If you have F13B in a String, you can transform it into the equivalent Unicode character with:
char awesomeChar = (char) Integer.parseInt("f13b", 16)
Output is
Note that this is a private use area character and you need to use a special icon font to see the icon you expect.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论