如何利用文本在TextView的一个首字母的Android应用程序 [英] How to capitalize a the first letter of text in a TextView in an Android Application
本文介绍了如何利用文本在TextView的一个首字母的Android应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不是指与textInput,无论是。我的意思是,一旦你有静态的文本在一个TextView(填充从数据库调用用户输入的数据(可能不是大写)),我怎么能确保他们的资本?
I'm not referring to textInput, either. I mean that once you have static text in a TextView (populated from a Database call to user inputted data (that may not be Capitalized)), how can I make sure they are capitalized?
谢谢!
推荐答案
我应该能够通过标准的java字符串处理,没有Android或TextView的具体做到这一点。
I should be able to accomplish this through standard java string manipulation, nothing Android or TextView specific.
是这样的:
String upperString = myString.substring(0,1).toUpperCase() + myString.substring(1);
虽然有可能是一百万的方式来做到这一点。请参见字符串的文档。
这篇关于如何利用文本在TextView的一个首字母的Android应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文