| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> asp >> ASP.NET wang luo bian cheng zhong jing chang yong dao de 27 ge han shu ji

ASP.NET wang luo bian cheng zhong jing chang yong dao de 27 ge han shu ji

2008-06-21 06:39:12 编辑來源:互联网 评论
 
 
 
本文为【ASP.NET网络编程中经常用到的27个函数集】的拼音翻译版
  1、DateTime shu zi xing
  yi xia shi yin yong pian duan :
  System.DateTime currentTime=new System.DateTime();
  1.1 qu dang qian nian yue ri shi fen miao currentTime=System.DateTime.Now;
  1.2 qu dang qian nian int nian =currentTime.Year;
  1.3 qu dang qian yue int yue =currentTime.Month;
  1.4 qu dang qian ri int ri =currentTime.Day;
  1.5 qu dang qian shi int shi =currentTime.Hour;
  1.6 qu dang qian fen int fen =currentTime.Minute;
  1.7 qu dang qian miao int miao =currentTime.Second;
  1.8 qu dang qian hao miao int hao miao =currentTime.Millisecond;
  ( bian liang ke yong zhong wen )
  2、Int32.Parse( bian liang ) Int32.Parse(" chang liang ")
  yi xia shi yin yong pian duan :
  zi fu xing zhuan huan zhuan wei 32 wei shu zi xing
  3、 bian liang .ToString()
  yi xia shi yin yong pian duan :
  zi fu xing zhuan huan zhuan wei zi fu chuan
  12345.ToString("n"); // sheng cheng 12,345.00
  12345.ToString("C"); // sheng cheng ¥12,345.00
  12345.ToString("e"); // sheng cheng 1.234500e+004
  12345.ToString("f4"); // sheng cheng 12345.0000
  12345.ToString("x"); // sheng cheng 3039 (16 jin zhi )
  12345.ToString("p"); // sheng cheng 1,234,500.00%
  4、 bian liang .Length shu zi xing
  yi xia shi yin yong pian duan :
  qu zi chuan chang du :
  ru : string str=" zhong guo ";
  int Len = str.Length ; //Len shi zi ding yi bian liang , str shi qiu ce de zi chuan de bian liang ming
  5、System.Text.Encoding.Default.GetBytes( bian liang )
  yi xia shi yin yong pian duan :
  zi ma zhuan huan zhuan wei bi te ma
  ru :byte[] bytStr = System.Text.Encoding.Default.GetBytes(str);
  ran hou ke de dao bi te chang du :
  len = bytStr.Length;
  6、System.Text.StringBuilder("")
  yi xia shi yin yong pian duan :
  zi fu chuan xiang jia ,(+ hao shi bu shi ye yi yang ?)
  ru :System.Text.StringBuilder sb = new System.Text.StringBuilder("");
  sb.Append(" zhong hua ");
  sb.Append(" ren min ");
  sb.Append(" gong he guo ");
  7、 bian liang .Substring( shen shu 1, shen shu 2);
  yi xia shi yin yong pian duan :
  jie qu zi chuan de yi bu fen , shen shu 1 wei zuo qi shi wei shu , shen shu 2 wei jie qu ji wei 。
  ru :string s1 = str.Substring(0,2);
  8、String user_IP=Request.ServerVariables["REMOTE_ADDR"].ToString();
  yi xia shi yin yong pian duan :
  qu yuan cheng yong hu IP di zhi
  9、 chuan guo dai li fu wu qi qu yuan cheng yong hu zhen shi IP di zhi :
  yi xia shi yin yong pian duan :
  if(Request.ServerVariables["HTTP_VIA"]!=null){
  string user_IP=Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
  }else{
  string user_IP=Request.ServerVariables["REMOTE_ADDR"].ToString();
  }
  10、 Session[" bian liang "];
  yi xia shi yin yong pian duan :
  cun qu Session zhi ;
  ru , fu zhi : Session["username"]=" xiao bu shen ";
  qu zhi : Object objName=Session["username"];
  String strName=objName.ToString();
  qing kong : Session.RemoveAll();
  11、String str=Request.QueryString[" bian liang "];
  yi xia shi yin yong pian duan :
  yong chao lian jie chuan song bian liang 。
  ru zai ren yi ye zhong jian chao lian jie : dian ji
  zai Edit.aspx ye zhong qu zhi :String str=Request.QueryString["fdid"];
  12、DOC dui xiang .CreateElement(" xin jian jie dian ming ");
  yi xia shi yin yong pian duan :
  chuang jian XML wen dang xin jie dian
  13、 fu jie dian .AppendChild( zi jie dian );
  yi xia shi yin yong pian duan :
  jiang xin jian de zi jie dian jia dao XML wen dang fu jie dian xia
  14、 fu jie dian .RemoveChild( jie dian );
  yi xia shi yin yong pian duan :
  shan chu jie dian
  15、Response
  yi xia shi yin yong pian duan :
  Response.Write(" zi chuan ");
  Response.Write( bian liang );
  xiang ye mian shu chu 。
  Response.Redirect("URL di zhi ");
  tiao zhuan dao URL zhi ding de ye mian
  16、char.IsWhiteSpce( zi chuan bian liang , wei shu )—— luo ji xing
  yi xia shi yin yong pian duan :
  cha zhi ding wei zhi shi fou kong zi fu ;
  ru :
  string str=" zhong guo ren min ";
  Response.Write(char.IsWhiteSpace(str,2)); // jie guo wei :True, di yi ge zi fu shi 0 wei ,2 shi di san ge zi fu 。
  17、char.IsPunctuation(' zi fu ') -- luo ji xing
  yi xia shi yin yong pian duan :
  cha zi fu shi fou shi biao dian fu hao
  ru :Response.Write(char.IsPunctuation('A')); // fan hui :False
  18、(int)' zi fu '
  yi xia shi yin yong pian duan :
  ba zi fu zhuan wei shu zi , cha dai ma dian , zhu yi shi dan yin hao 。
  ru :
  Response.Write((int)' zhong '); // jie guo wei zhong zi de dai ma :20013
  19、(char) dai ma
  yi xia shi yin yong pian duan :
  ba shu zi zhuan wei zi fu , cha dai ma dai biao de zi fu 。
  ru :
  Response.Write((char)22269); // fan hui “ guo ” zi 。
  20、 Trim()
  yi xia shi yin yong pian duan :
  qing chu zi chuan qian hou kong ge
  21 、 zi chuan bian liang .Replace(" zi zi chuan "," ti huan wei ")
  yi xia shi yin yong pian duan :
  zi chuan ti huan
  ru :
  
  string str=" zhong guo ";
  str=str.Replace(" guo "," yang "); // jiang guo zi huan wei yang zi
  Response.Write(str); // shu chu jie guo wei “ zhong yang ”
  zai ru :( zhe ge fei chang shi yong )
  string str=" zhe shi <script> jiao ben ";
  str=str.Replace("<","<font><</font>");
  // jiang zuo jian kuo hao ti huan wei <font> yu < yu </font>
  ( huo huan wei <, dan gu ji jing XML cun zhu hou , zai ti chu reng hui huan yuan )
  Response.Write(str); // xian shi wei :“ zhe shi <script> jiao ben ”
  ru guo bu ti huan ,<script> jiang bu xian shi , ru guo shi yi duan jiao ben , jiang yun xing ;
  er ti huan hou , jiao ben jiang bu yun xing 。
  zhe duan dai ma de jia zhi zai yu : ni ke yi rang yi ge wen ben zhong de suo you HTML biao qian shi xiao ,
  quan bu xian shi chu lai , bao hu ni de ju you jiao hu xing de zhan dian 。
  ju ti shi xian : jiang ni de biao dan ti jiao an niu jiao ben jia shang xia mian dai ma :
  string strSubmit=label1.Text; //label1 shi ni rang yong hu ti jiao shu ju de kong jian ID。
  strSubmit=strSubmit.Replace("<","<font><</font>");
  ran hou bao cun huo shu chu strSubmit。
  yong ci fang fa huan ke yi jian dan shi xian UBB dai ma 。
  22、Math.Max(i,j)
  yi xia shi yin yong pian duan :
  qu i yu j zhong de zui da zhi
  ru int x=Math.Max(5,10); // x jiang qu zhi 10
  jia yi dian ba 23、 zi chuan dui bi ......
  jia yi dian ba
  23、 zi chuan dui bi yi ban dou yong : if(str1==str2){ } , dan huan you bie de fang fa :
  yi xia shi yin yong pian duan :
  (1)、
  string str1; str2
  // yu fa : str1.EndsWith(str2); __ jian ce zi chuan str1 shi fou yi zi chuan str2 jie yi , fan hui bu er zhi . ru :
  if(str1.EndsWith(str2)){ Response.Write(" zi chuan str1 shi yi "+str2+" jie shu de "); }
  (2)、
  // yu fa :str1.Equals(str2); __ jian ce zi chuan str1 shi fou yu zi chuan str2 xiang deng , fan hui bu er zhi , yong fa tong shang .
  (3)、
  // yu fa Equals(str1,str2); __ jian ce zi chuan str1 shi fou yu zi chuan str2 xiang deng , fan hui bu er zhi , yong fa tong shang .
  24、IndexOf() 、LastIndexOf()
  yi xia shi yin yong pian duan :
  cha zhao zi chuan zhong zhi ding zi fu huo zi chuan shou ci ( zui hou yi ci ) chu xian de wei zhi , fan hui suo yin zhi , ru :
  str1.IndexOf(" zi "); // cha zhao “ zi ” zai str1 zhong de suo yin zhi ( wei zhi )
  str1.IndexOf(" zi chuan ");// cha zhao “ zi chuan ” de di yi ge zi fu zai str1 zhong de suo yin zhi ( wei zhi )
  str1.IndexOf(" zi chuan ",3,2);// cong str1 di 4 ge zi fu qi , cha zhao 2 ge zi fu , cha zhao “ zi chuan ” de di yi ge zi fu zai str1 zhong de suo yin zhi ( wei zhi )
  25、Insert()
  yi xia shi yin yong pian duan :
  zai zi chuan zhong zhi ding suo yin wei cha ru zhi ding zi fu 。 ru :
  str1.Insert(1," zi "); zai str1 de di er ge zi fu chu cha ru “ zi ”, ru guo str1=" zhong guo ", cha ru hou wei “ zhong zi guo ”;
  26、PadLeft()、PadRight()
  yi xia shi yin yong pian duan :
  zai zi chuan zuo ( huo you ) jia kong ge huo zhi ding char zi fu , shi zi chuan da dao zhi ding chang du , ru :
  
  <%
  string str1=" zhong guo ren ";
  str1=str1.PadLeft(10,'1'); // wu di er shen shu wei jia kong ge
  Response.Write(str1); // jie guo wei “1111111 zhong guo ren ” , zi chuan chang wei 10
  %>
  27、Remove()
  yi xia shi yin yong pian duan :
  cong zhi ding wei zhi kai shi shan chu zhi ding shu de zi fu
  zi chuan dui bi yi ban dou yong : if(str1==str2){ }【原文】【汉音对照
 
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
1、DateTime shu zi xing yi xia shi yin yong pian duan : System.DateTime currentTime=new System.DateTime(); 1.1 qu dang qian nian yue ri shi fen miao currentTime=System.DateTime.Now; 1.2 qu dang qian nian int nian =currentTime.Year; 1.3 qu dang qian yue int yue =currentTime.Month; 1.4 qu dang qian ri int ri =currentTime.Day; 1.5 qu dang qian shi int shi =currentTime.Hour; 1.6 qu dang qian fen int fen =currentTime.Minute; 1.7 qu dang qian miao int miao =currentTime.Second; 1.8 qu dang qian hao miao int hao miao =currentTime.Millisecond; ( bian liang ke yong zhong wen ) 2、Int32.Parse( bian liang ) Int32.Parse(" chang liang ") yi xia shi yin yong pian duan : zi fu xing zhuan huan zhuan wei 32 wei shu zi xing 3、 bian liang .ToString() yi xia shi yin yong pian duan : zi fu xing zhuan huan zhuan wei zi fu chuan 12345.ToString("n"); // sheng cheng 12,345.00 12345.ToString("C"); // sheng cheng ¥12,345.00 12345.ToString("e"); // sheng cheng 1.234500e+004 12345.ToString("f4"); // sheng cheng 12345.0000 12345.ToString("x"); // sheng cheng 3039 (16 jin zhi ) 12345.ToString("p"); // sheng cheng 1,234,500.00% 4、 bian liang .Length shu zi xing yi xia shi yin yong pian duan : qu zi chuan chang du : ru : string str=" zhong guo "; int Len = str.Length ; //Len shi zi ding yi bian liang , str shi qiu ce de zi chuan de bian liang ming 5、System.Text.Encoding.Default.GetBytes( bian liang ) yi xia shi yin yong pian duan : zi ma zhuan huan zhuan wei bi te ma ru :byte[] bytStr = System.Text.Encoding.Default.GetBytes(str); ran hou ke de dao bi te chang du : len = bytStr.Length; 6、System.Text.StringBuilder("") yi xia shi yin yong pian duan : zi fu chuan xiang jia ,(+ hao shi bu shi ye yi yang ?) ru :System.Text.StringBuilder sb = new System.Text.StringBuilder(""); sb.Append(" zhong hua "); sb.Append(" ren min "); sb.Append(" gong he guo "); 7、 bian liang .Substring( shen shu 1, shen shu 2); yi xia shi yin yong pian duan : jie qu zi chuan de yi bu fen , shen shu 1 wei zuo qi shi wei shu , shen shu 2 wei jie qu ji wei 。 ru :string s1 = str.Substring(0,2); 8、String user_IP=Request.ServerVariables["REMOTE_ADDR"].ToString(); yi xia shi yin yong pian duan : qu yuan cheng yong hu IP di zhi 9、 chuan guo dai li fu wu qi qu yuan cheng yong hu zhen shi IP di zhi : yi xia shi yin yong pian duan : if(Request.ServerVariables["HTTP_VIA"]!=null){ string user_IP=Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString(); }else{ string user_IP=Request.ServerVariables["REMOTE_ADDR"].ToString(); } 10、 Session[" bian liang "]; yi xia shi yin yong pian duan : cun qu Session zhi ; ru , fu zhi : Session["username"]=" xiao bu shen "; qu zhi : Object objName=Session["username"]; String strName=objName.ToString(); qing kong : Session.RemoveAll(); 11、String str=Request.QueryString[" bian liang "]; yi xia shi yin yong pian duan : yong chao lian jie chuan song bian liang 。 ru zai ren yi ye zhong jian chao lian jie : dian ji zai Edit.aspx ye zhong qu zhi :String str=Request.QueryString["fdid"]; 12、DOC dui xiang .CreateElement(" xin jian jie dian ming "); yi xia shi yin yong pian duan : chuang jian XML wen dang xin jie dian 13、 fu jie dian .AppendChild( zi jie dian ); yi xia shi yin yong pian duan : jiang xin jian de zi jie dian jia dao XML wen dang fu jie dian xia 14、 fu jie dian .RemoveChild( jie dian ); yi xia shi yin yong pian duan : shan chu jie dian 15、Response yi xia shi yin yong pian duan : Response.Write(" zi chuan "); Response.Write( bian liang ); xiang ye mian shu chu 。 Response.Redirect("URL di zhi "); tiao zhuan dao URL zhi ding de ye mian 16、char.IsWhiteSpce( zi chuan bian liang , wei shu )—— luo ji xing yi xia shi yin yong pian duan : cha zhi ding wei zhi shi fou kong zi fu ; ru : string str=" zhong guo ren min "; Response.Write(char.IsWhiteSpace(str,2)); // jie guo wei :True, di yi ge zi fu shi 0 wei ,2 shi di san ge zi fu 。 17、char.IsPunctuation(' zi fu ') -- luo ji xing yi xia shi yin yong pian duan : cha zi fu shi fou shi biao dian fu hao ru :Response.Write(char.IsPunctuation('A')); // fan hui :False 18、(int)' zi fu ' yi xia shi yin yong pian duan : ba zi fu zhuan wei shu zi , cha dai ma dian , zhu yi shi dan yin hao 。 ru : Response.Write((int)' zhong '); // jie guo wei zhong zi de dai ma :20013 19、(char) dai ma yi xia shi yin yong pian duan : ba shu zi zhuan wei zi fu , cha dai ma dai biao de zi fu 。 ru : Response.Write((char)22269); // fan hui “ guo ” zi 。 20、 Trim() yi xia shi yin yong pian duan : qing chu zi chuan qian hou kong ge 21 、 zi chuan bian liang .Replace(" zi zi chuan "," ti huan wei ") yi xia shi yin yong pian duan : zi chuan ti huan ru : string str=" zhong guo "; str=str.Replace(" guo "," yang "); // jiang guo zi huan wei yang zi Response.Write(str); // shu chu jie guo wei “ zhong yang ” zai ru :( zhe ge fei chang shi yong ) string str=" zhe shi <script> jiao ben "; str=str.Replace("<","<font><</font>"); // jiang zuo jian kuo hao ti huan wei <font> yu < yu </font> ( huo huan wei <, dan gu ji jing XML cun zhu hou , zai ti chu reng hui huan yuan ) Response.Write(str); // xian shi wei :“ zhe shi <script> jiao ben ” ru guo bu ti huan ,<script> jiang bu xian shi , ru guo shi yi duan jiao ben , jiang yun xing ; er ti huan hou , jiao ben jiang bu yun xing 。 zhe duan dai ma de jia zhi zai yu : ni ke yi rang yi ge wen ben zhong de suo you HTML biao qian shi xiao , quan bu xian shi chu lai , bao hu ni de ju you jiao hu xing de zhan dian 。 ju ti shi xian : jiang ni de biao dan ti jiao an niu jiao ben jia shang xia mian dai ma : string strSubmit=label1.Text; //label1 shi ni rang yong hu ti jiao shu ju de kong jian ID。 strSubmit=strSubmit.Replace("<","<font><</font>"); ran hou bao cun huo shu chu strSubmit。 yong ci fang fa huan ke yi jian dan shi xian UBB dai ma 。 22、Math.Max(i,j) yi xia shi yin yong pian duan : qu i yu j zhong de zui da zhi ru int x=Math.Max(5,10); // x jiang qu zhi 10 jia yi dian ba 23、 zi chuan dui bi ...... jia yi dian ba 23、 zi chuan dui bi yi ban dou yong : if(str1==str2){ } , dan huan you bie de fang fa : yi xia shi yin yong pian duan : (1)、 string str1; str2 // yu fa : str1.EndsWith(str2); __ jian ce zi chuan str1 shi fou yi zi chuan str2 jie yi , fan hui bu er zhi . ru : if(str1.EndsWith(str2)){ Response.Write(" zi chuan str1 shi yi "+str2+" jie shu de "); } (2)、 // yu fa :str1.Equals(str2); __ jian ce zi chuan str1 shi fou yu zi chuan str2 xiang deng , fan hui bu er zhi , yong fa tong shang . (3)、 // yu fa Equals(str1,str2); __ jian ce zi chuan str1 shi fou yu zi chuan str2 xiang deng , fan hui bu er zhi , yong fa tong shang . 24、IndexOf() 、LastIndexOf() yi xia shi yin yong pian duan : cha zhao zi chuan zhong zhi ding zi fu huo zi chuan shou ci ( zui hou yi ci ) chu xian de wei zhi , fan hui suo yin zhi , ru : str1.IndexOf(" zi "); // cha zhao “ zi ” zai str1 zhong de suo yin zhi ( wei zhi ) str1.IndexOf(" zi chuan ");// cha zhao “ zi chuan ” de di yi ge zi fu zai str1 zhong de suo yin zhi ( wei zhi ) str1.IndexOf(" zi chuan ",3,2);// cong str1 di 4 ge zi fu qi , cha zhao 2 ge zi fu , cha zhao “ zi chuan ” de di yi ge zi fu zai str1 zhong de suo yin zhi ( wei zhi ) 25、Insert() yi xia shi yin yong pian duan : zai zi chuan zhong zhi ding suo yin wei cha ru zhi ding zi fu 。 ru : str1.Insert(1," zi "); zai str1 de di er ge zi fu chu cha ru “ zi ”, ru guo str1=" zhong guo ", cha ru hou wei “ zhong zi guo ”; 26、PadLeft()、PadRight() yi xia shi yin yong pian duan : zai zi chuan zuo ( huo you ) jia kong ge huo zhi ding char zi fu , shi zi chuan da dao zhi ding chang du , ru : <% string str1=" zhong guo ren "; str1=str1.PadLeft(10,'1'); // wu di er shen shu wei jia kong ge Response.Write(str1); // jie guo wei “1111111 zhong guo ren ” , zi chuan chang wei 10 %> 27、Remove() yi xia shi yin yong pian duan : cong zhi ding wei zhi kai shi shan chu zhi ding shu de zi fu zi chuan dui bi yi ban dou yong : if(str1==str2){ }
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
华丽的模特拍摄(8)
华丽的模特拍摄(7)
华丽的模特拍摄(6)
华丽的模特拍摄(5)
八里沟
朝阳宫
天下峨眉 云上金顶
老家(四)
 
>>返回首页<<
 
 
 为你推荐
 
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
 
©2005- 王朝网络 版权所有