会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
oosumu
懒鬼,门外汉
博客园
首页
新随笔
联系
订阅
管理
公告
some function
public
bool
isnumeric(
string
str)
{
char
[] ch
=
new
char
[str.Length];
ch
=
str.ToCharArray();
for
(
int
i
=
0
;i
<
ch.Length;i
++
)
{
if
(ch[i]
<
48
||
ch[i]
>
57
)
return
false
;
}
return
true
;
}
public
string
coder(
string
source)
{
if
(source
!=
string
.Empty
&&
source
!=
null
)
{
source
=
source.Replace(
"
<
"
,
"
<<
"
);
source
=
source.Replace(
"
>
"
,
"
>>
"
);
source
=
source.Replace(
"
\r\n
"
,
"
<br/>
"
);
source
=
source.Replace(
"
\n
"
,
"
<br/>
"
);
source
=
source.Replace(
"
"
,
"
 
"
);
return
source;
}
else
{
return
source;
}
}
public
bool
IsNumeric(
string
s,
out
double
result)
{
bool
bReturn
=
true
;
try
{
result
=
double
.Parse(s);
}
catch
{
result
=
0
;
bReturn
=
false
;
}
return
bReturn;
}
public
int
IsNumeric(
string
str)
{
int
i;
if
(str
!=
null
&&
Regex.IsMatch(str,
@"
^\d+$
"
))
i
=
int
.Parse(str);
else
i
=
-
1
;
return
i;
}
posted on
2005-01-12 21:15
- -
阅读(
776
) 评论(
0
)
收藏
举报
刷新页面
返回顶部
博客园
© 2004-2025
浙公网安备 33010602011771号
浙ICP备2021040463号-3