some function

None.gif      public   bool  isnumeric( string  str)
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif {
InBlock.gif            
char[] ch=new char[str.Length];
InBlock.gif            ch
=str.ToCharArray();
InBlock.gif            
for(int i=0;i<ch.Length;i++)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if(ch[i]<48 || ch[i]>57)
InBlock.gif                    
return false;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
return true;
ExpandedBlockEnd.gif        }

None.gif
None.gif        
public   string  coder( string  source)
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif {
InBlock.gif            
if(source!=string.Empty&&source!=null)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif              
InBlock.gif
InBlock.gif        source 
=source.Replace("<","<<");
InBlock.gif        source
=source.Replace(">",">>");
InBlock.gif        source
= source.Replace("\r\n""<br/>");
InBlock.gif        source
= source.Replace("\n""<br/>");
InBlock.gif        source  
= source.Replace(" ""&nbsp");
InBlock.gif    
InBlock.gif                
return source;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockStart.gifContractedSubBlock.gif            
elsedot.gif{
InBlock.gif            
InBlock.gif            
return source;
ExpandedSubBlockEnd.gif            }

InBlock.gif        
InBlock.gif        
ExpandedBlockEnd.gif        }
None.gif public   bool  IsNumeric( string  s,  out   double  result)
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
InBlock.gif   
bool bReturn = true;
InBlock.gif   
try
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif       result 
= double.Parse(s);
ExpandedSubBlockEnd.gif   }

InBlock.gif   
catch
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif       result 
= 0;
InBlock.gif       bReturn 
= false;
ExpandedSubBlockEnd.gif   }

InBlock.gif   
return bReturn;      
ExpandedBlockEnd.gif}
None.gif public   int  IsNumeric( string  str)
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
InBlock.gif      
int i;
InBlock.gif      
if(str != null && Regex.IsMatch(str,@"^\d+$"))
InBlock.gif                i 
= int.Parse(str);
InBlock.gif      
else
InBlock.gif                i 
= -1;
InBlock.gif       
return i;
ExpandedBlockEnd.gif}

转载于:https://www.cnblogs.com/oosumu/archive/2005/01/12/90891.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值