English 中文(简体)
提取创建缩写首字母字符
原标题:Extract first character of word to create acronym
  • 时间:2012-05-24 00:17:22
  •  标签:
  • java

我如何使用拆分或字符串控制器来获取每个单词的第一个字符来创建首字母来创建首字母缩写? 它还将包括 & amp; 符号。 它不区分大小写

外观 :

  • Some Kind Of Long String ---> SKOLS
  • another Kind of Long String ---> AKOLS
  • string & string ---> s&s

原因是我有一个填充表格的查询,而且由于列名是3个或3个以上的单词。它拉伸了表格,即使放置了一个滚动条,长名的100+列也会让它看起来长。所以我想通过只使用缩写和生成一个传说来缩小篇幅。

最佳回答

首先,您需要将 string 分割为“ ” 或“ amp;” 。

您可以使用“ Split” 字符串方法。 < a href="http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/String.html#split(java.lang.String.String” rel=“nofollow” >http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/String.html#split(java.lang.string.String

The regular expression would be either space or ampersand. Then you would use the charAt method to get the character at index 0. You would concatenate the characters to get the acronym.

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签