|
|
 | | From: | Ben | | Subject: | 关于字符串问题. | | Date: | Tue, 18 Jan 2005 11:25:42 +0800 |
|
|
 | 字符串: #EXTM3U#EXTINF:230,http://192.168.167.20/mp3/2.女歌手/R-容祖儿/容祖儿-Give Love A Break/身骄肉贵(电影身骄肉贵主题 曲).mp3http://192.168.167.20/mp3/2.女歌手/R-容祖儿/容祖儿-Give_Love_A_Break/身骄肉贵(电影身骄肉贵主题曲).mp3
我想将 以 "http" 开头,以".mp3"结尾,这样分割字符串,如何实现?
|
|
 | | From: | lanWay | | Subject: | Re: 关于字符串问题. | | Date: | Tue, 18 Jan 2005 13:18:15 +0800 |
|
|
 | Ben,你好: 你可以使用string的折分(splict)功能把字符分成一個字符數組即可
-- --希望對你有所幫助! ※※※※※※※※※※※※※※※ ※不要懷疑過去●不要懷疑將來※ ※不要懷疑自己●不要懷疑他人※ ※今天有你精彩●明天有你美麗※ ※用心的去生活●誠心的去助人※ ※※※※※理想●lanWay※※※※
"Ben" 在郵件 news:e1sBg1Q$EHA.3840@tk2msftngp13.phx.gbl 中撰寫... > 字符串: #EXTM3U#EXTINF:230,http://192.168.167.20/mp3/2.女歌手/R-容祖儿/ 容祖儿-Give Love A Break/身骄肉贵(电影身骄肉贵主题 > 曲).mp3http://192.168.167.20/mp3/2.女歌手/R-容祖儿/容祖 儿-Give_Love_A_Break/身骄肉贵(电影身骄肉贵主题曲).mp3 > > 我想将 以 "http" 开头,以".mp3"结尾,这样分割字符串,如何实现? > >
|
|
 | | From: | Vince Yuan | | Subject: | =?gb2312?B?UmU6ILnY09rX1rf7tK7OysziLg==?= | | Date: | Tue, 18 Jan 2005 12:05:18 +0800 |
|
|
 | This is a multi-part message in MIME format.
------=_NextPart_000_0009_01C4FD55.FA82CC60 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable
strMid =3D str.Substring( 4, str.Length - 4 - 4 );
String.Substring Method [C#]
Retrieves a substring from this instance.
Overload List Retrieves a substring from this instance. The substring starts at a = specified character position.
[C#] public string Substring(int); Retrieves a substring from this instance. The substring starts at a = specified character position and has a specified length.
[C#] public string Substring(int, int);
Example [Visual Basic]=20 Dim myString As String =3D "abc" Dim test1 As Boolean =3D String.Compare(myString.Substring(2, 1), "c") = =3D 0 ' This is true. myString.Substring(3, 1) ' This throws ArgumentOutOfRangeException. Dim test2 As Boolean =3D String.Compare(myString.Substring(3, 0), = String.Empty) =3D 0 ' This is true. [C#]=20 String myString =3D "abc"; bool test1 =3D String.Compare(myString.Substring(2, 1), "c") =3D=3D 0; = // This is true. myString.Substring(3, 1); // This throws ArgumentOutOfRangeException. bool test2 =3D String.Compare(myString.Substring(3, 0), String.Empty) = =3D=3D 0; // This is true.
--=20 Vince
"Ben" wrote in message = news:e1sBg1Q$EHA.3840@tk2msftngp13.phx.gbl... > =D7=D6=B7=FB=B4=AE: = #EXTM3U#EXTINF:230,http://192.168.167.20/mp3/2.=C5=AE=B8=E8=CA=D6/R-=C8=DD= =D7=E6=B6=F9/=C8=DD=D7=E6=B6=F9-Give Love A = Break/=C9=ED=BD=BE=C8=E2=B9=F3(=B5=E7=D3=B0=C9=ED=BD=BE=C8=E2=B9=F3=D6=F7= =CC=E2=20 > = =C7=FA).mp3http://192.168.167.20/mp3/2.=C5=AE=B8=E8=CA=D6/R-=C8=DD=D7=E6=B6= =F9/=C8=DD=D7=E6=B6=F9-Give_Love_A_Break/=C9=ED=BD=BE=C8=E2=B9=F3(=B5=E7=D3= =B0=C9=ED=BD=BE=C8=E2=B9=F3=D6=F7=CC=E2=C7=FA).mp3 >=20 > =CE=D2=CF=EB=BD=AB =D2=D4 "http" = =BF=AA=CD=B7,=D2=D4".mp3"=BD=E1=CE=B2,=D5=E2=D1=F9=B7=D6=B8=EE=D7=D6=B7=FB= =B4=AE,=C8=E7=BA=CE=CA=B5=CF=D6?=20 >=20 > ------=_NextPart_000_0009_01C4FD55.FA82CC60 Content-Type: text/html; charset="gb2312" Content-Transfer-Encoding: quoted-printable
strMid =3D str.Substring( 4, str.Length = - 4 - 4=20 );
style=3D"PADDING-RIGHT: 10px; PADDING-LEFT: 22px; PADDING-BOTTOM: 0px; = PADDING-TOP: 0px"> hidden">
style=3D"PADDING-RIGHT: 20px; OVERFLOW: auto; WIDTH: 934px; TOP: 0px; = HEIGHT: 500px"=20 valign=3D"bottom"> onload=3D"loadAll()"> Retrieves a substring from this instance. Overload ListRetrieves a substring from this instance. The substring starts at a = specified=20 character position. size=3D2> = href=3D"ms-help://MS.MSDNQTR.2004APR.1033/cpref/html/frlrfsystemstringcla= sssubstringtopic1.htm"> style=3D"DISPLAY: none">[C#] = href=3D"ms-help://MS.MSDNQTR.2004APR.1033/cpref/html/frlrfsystemstringcla= sssubstringtopic1.htm">public=20 string Substring(int); Retrieves a substring from this instance. The substring starts at a = specified=20 character position and has a specified length.
= href=3D"ms-help://MS.MSDNQTR.2004APR.1033/cpref/html/frlrfsystemstringcla= sssubstringtopic2.htm"> class=3Dlang style=3D"DISPLAY: none">[C#] href=3D"ms-help://MS.MSDNQTR.2004APR.1033/cpref/html/frlrfsystemstringcla= sssubstringtopic2.htm">public=20 string Substring(int, int);Examplenone">none">[Visual Basic]=20 Dim myString As String =3D "abc" Dim test1 As Boolean =3D String.Compare(myString.Substring(2, 1), "c") = =3D 0 ' This is true. myString.Substring(3, 1) ' This throws ArgumentOutOfRangeException. Dim test2 As Boolean =3D String.Compare(myString.Substring(3, 0), = String.Empty) =3D 0 ' This is true. style=3D"DISPLAY: none">[C#]=20 String myString =3D "abc"; bool test1 =3D String.Compare(myString.Substring(2, 1), "c") =3D=3D 0; = // This is true. myString.Substring(3, 1); // This throws ArgumentOutOfRangeException. bool test2 =3D String.Compare(myString.Substring(3, 0), String.Empty) = =3D=3D 0; // This is true.
-- Vince
> = =D7=D6=B7=FB=B4=AE: =20 #EXTM3U#EXTINF:230,http://192.168.167.20/mp3/2.=C5=AE=B8=E8=CA=D6/R-=C8=DD= =D7=E6=B6=F9/=C8=DD=D7=E6=B6=F9-Give Love A=20 Break/=C9=ED=BD=BE=C8=E2=B9=F3(=B5=E7=D3=B0=C9=ED=BD=BE=C8=E2=B9=F3=D6=F7= =CC=E2 >=20 =C7=FA).mp3http://192.168.167.20/mp3/2.=C5=AE=B8=E8=CA=D6/R-=C8=DD=D7=E6=B6= =F9/=C8=DD=D7=E6=B6=F9-Give_Love_A_Break/=C9=ED=BD=BE=C8=E2=B9=F3(=B5=E7=D3= =B0=C9=ED=BD=BE=C8=E2=B9=F3=D6=F7=CC=E2=C7=FA).mp3 >=20
> =CE=D2=CF=EB=BD=AB =D2=D4 "http" = =BF=AA=CD=B7,=D2=D4".mp3"=BD=E1=CE=B2,=D5=E2=D1=F9=B7=D6=B8=EE=D7=D6=B7=FB= =B4=AE,=C8=E7=BA=CE=CA=B5=CF=D6? >=20
>
------=_NextPart_000_0009_01C4FD55.FA82CC60--
|
|
 | | From: | Zhen.Liang | | Subject: | Re: 关于字符串问题. | | Date: | Wed, 19 Jan 2005 01:04:14 +0800 |
|
|
 | 使用splict将其才分后存储到数组就可以了
"Ben" wrote in message news:e1sBg1Q$EHA.3840@tk2msftngp13.phx.gbl... > 字符串: #EXTM3U#EXTINF:230,http://192.168.167.20/mp3/2.女歌手/R-容祖儿/容祖儿-Give Love A Break/身骄肉贵(电影身骄肉贵主题 > 曲).mp3http://192.168.167.20/mp3/2.女歌手/R-容祖儿/容祖儿-Give_Love_A_Break/身骄肉贵(电影身骄肉贵主题曲).mp3>> 我想将 以 "http" 开头,以".mp3"结尾,这样分割字符串,如何实现?>
|
|
 | | From: | Vincent | | Subject: | Re: =?GB2312?B?udjT2tfWt/u0rs7KzOIu?= | | Date: | Tue, 18 Jan 2005 16:03:40 +0800 |
|
|
 | Ben 写道: > 字符串: #EXTM3U#EXTINF:230,http://192.168.167.20/mp3/2.女歌手/R-容祖儿/容祖儿-Give Love A Break/身骄肉贵(电影身骄肉贵主题 > 曲).mp3http://192.168.167.20/mp3/2.女歌手/R-容祖儿/容祖儿-Give_Love_A_Break/身骄肉贵(电影身骄肉贵主题曲).mp3 > > 我想将 以 "http" 开头,以".mp3"结尾,这样分割字符串,如何实现? > > ^http://(.*?)\.mp3$
|
|
|