| « | December 2025 | » | | 日 | 一 | 二 | 三 | 四 | 五 | 六 | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | | | | |
| 公告 |
|
工作中的Janet.加油!
生活中的Janet.i-life
|
| Blog信息 |
|
blog名称: 日志总数:30 评论数量:10 留言数量:0 访问次数:86288 建立时间:2005年8月31日 |

| |
|
[Java Tips]JOIN table 文章收藏
janetvsfei 发表于 2006/1/5 12:59:05 |
Tip time:
(Background: This database is used to keep track of scores for students in my classes.)
So in this case, I have three tables, one has student's "codename" (as posting their real name on the web is a no-no) and an index (there is more data in this table, but this is all you really need to know.) Then there's a table with the assignments, containing the assignment name, and an index for each assignment. Finally, there is a scores |
|
|
[Java Tips]My Favorite (Dead) Java Boilerplate 文章收藏
janetvsfei 发表于 2005/11/17 8:59:07 |
|
In the Java platform we have tended to focus on adding lots of power and flexibility. That's great, but sometimes that power and flexibility can get in the way of doing common tasks. As part of the Ease-of-Development initiative we have been focusing on simplifying common tasks and getting rid of unnecessary boilerplate code.
Here are my five of my favorite cleanups so far:
#1: Opening a Text File
In JDK 1.1 to 1.4, in order to open a simple text output fil |
|
|
[Java Tips]一段判断字符串是不是中文的代码. 网上资源
janetvsfei 发表于 2005/9/22 9:47:00 |
String aa = "中国China人"; for (int i = 0; i < aa.length(); i++) { String bb = aa.substring(i, i+1); //生成一个Pattern,同时编译一个正则表达式 boolean cc = java.util.regex.Pattern.matches("[\u4E00-\u9FA5]", bb); System.out.println(bb+" is chinese?->"+cc); |
|
|
[Java Tips]精确截取字符串 网上资源
janetvsfei 发表于 2005/9/7 10:52:30 |
开发中经常遇到,字符串过长,无法完全显示的问题
这时候就需要截取我们所需要的长度,后面显示省略号或其他字符。
由于中文字符占两个字节,而英文字符占用一个字节,所以,单纯地判断字符数,效果往往不尽如人意
下面的方法通过判断字符的类型来进行截取,效果还算可以:)
如果大家有其他的解决方法欢迎贴出来,共同学习:) ********************************************************************** private String str; private int counterOfDoubleByte; private byte b[]; /** * 设置需要被限制长度的字符串 * @param str 需要被限制长度的字符串 */ public void setLimitLengthString(String str){ this.str = str; } /** * @param |
|
« 1 ›
|