请问在ASP中如何判断一个数字的二进制形式里某一位是0还是1

CokeStar 2004-12-06 02:36:09
比如6这个数,我想判断第二位是否是1,如何作?
...全文
130 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
kingkingxy 2004-12-06
  • 打赏
  • 举报
回复
<input type="radio" <%if list_record("checked")=true then response.Write "CHECKED" end if%> value="1" name="checked" ID="radio" <%if list_record("checked")=true then response.write "checked" end if%>1>

<input type="radio" <%if list_record("checked")=false then response.Write "CHECKED" end if%> value="0" name="checked" ID="radio" <%if list_record("checked")=false then response.write "checked" end if%>1>
否</td>
lienzhu 2004-12-06
  • 打赏
  • 举报
回复
忘了get是关键字


<%
function getNum(Num,Pos)
getNum=(Num And (2 ^ (Pos - 1))) / (2 ^ (Pos - 1))
end function
response.write getNum(6,2)

%>
lienzhu 2004-12-06
  • 打赏
  • 举报
回复
function get(Num,Pos)
get=(Num And (2 ^ (Pos - 1))) / (2 ^ (Pos - 1))
end function
response.write get(6,2)
sdliubo 2004-12-06
  • 打赏
  • 举报
回复
看看這個
http://community.csdn.net/Expert/topic/3377/3377078.xml?temp=.1677057
micher_yan 2004-12-06
  • 打赏
  • 举报
回复
dim str
str=cint(num)
if len(str)>2 then
if left(right(len(str)-1),1)<>"1" then
response.write "不是1"
else
response.write "是1"
end if
else
response.write "不是2位数"
end if

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧