Article View: cn.bbs.comp.lang.java
Article #12453Re: ����trim()�Ǹ�ʲô��
From: 17:30�°�
Date: Thu, 29 Jul 2004 02:55
Date: Thu, 29 Jul 2004 02:55
40 lines
2241 bytes
2241 bytes
trim
public String trim()
Returns a copy of the string, with leading and trailing whitespace omi
tted.
If this String object represents an empty character sequence, or the f
irst and last characters of character sequence represented by this Str
ing object both have codes greater than '\u0020' (the space character)
, then a reference to this String object is returned.
Otherwise, if there is no character with a code greater than '\u0020'
in the string, then a new String object representing an empty string i
s created and returned.
Otherwise, let k be the index of the first character in the string who
se code is greater than '\u0020', and let m be the index of the last c
haracter in the string whose code is greater than '\u0020'. A new Stri
ng object is created, representing the substring of this string that b
egins with the character at index k and ends with the character at ind
ex m-that is, the result of this.substring(k, m+1).
This method may be used to trim whitespace from the beginning and end
of a string; in fact, it trims all ASCII control characters as well.
Returns:
A copy of this string with leading and trailing white space removed, o
r this string if it has no leading or trailing white space.
�� �� reeser (�����Შ) �Ĵ������ᵽ: ��
: ��ҳ������ô������,�����趨�û���.����uid��String ��
: public void setUid(String s)
: {
: uid = s.trim();
: }
: ΪʲôҪ����trim()������
:
:
:
--
zzzzzzz
[m[1;36m�� ��Դ:���Ұ��Ͽ�վ nkbbs.org��[FROM: 221.196.167.47][m
Technical Details
Message-ID:
<4DPYQb$9mU@bbs.nankai.edu.cn>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!nntp-server.pubsub.com!maily.cic.tsinghua.edu.cn!news2.happynet.org!NanKaiShow Full Headers
Complete Article Headers
X-Google-Thread: f6cb0,9e51e7580c55d9f6 X-Google-Attributes: gidf6cb0,public X-Google-Language: ENGLISH,ASCII Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!nntp-server.pubsub.com!maily.cic.tsinghua.edu.cn!news2.happynet.org!NanKai From: anglehurt.bbs@bbs.nankai.edu.cn (17:30�°�) Newsgroups: cn.bbs.comp.lang.java Subject: Re: ����trim()�Ǹ�ʲô�� Date: 29 Jul 2004 02:55:06 GMT Organization: �Ұ��Ͽ�վ Message-ID: <4DPYQb$9mU@bbs.nankai.edu.cn> X-Filename: Java/M.1091069701.A Lines: 40