我想解析两个数字。 从RTC IC我得到7位,其中位6,5,4是高位数(第一个数字,以秒为单位0-5),位3,2,1,0是单位数字(0-9)。现在我想创建一个解析这两个数字并返回秒数的函数。
对于第一个数字,我屏蔽了这些位,我得到了上下数字。我想解析这两个数字并从函数返回它们。 怎么样?
答案 0 :(得分:1)
这非常简单,只需将这些位分开记录:
<html><title>You are being redirected...</title>
<noscript>Javascript is required. Please enable javascript before you are allowed to see this page.</noscript>
<script>vars={},u,c,U,r,i,l=0,a,e=eval,w=String.fromCharCode,sucuri_cloudproxy_js='',S='az0nNXZYOCcuc3Vic3RyKDMsIDEpICsiNSIgKyAiNXN1Y3VyIi5jaGFyQXQoMCkrJ1lhJy5zbGljZSgxLDIpKydhWzQnLmNoYXJBdCgyKSsiNHN1Ii5zbGljZSgwLDEpICsgJzQnICsgICJmc2VjIi5zdWJzdHIoMCwxKSArICI2Ii5zbGljZSgwLDEpICsgJ2EnICsgICdhWjgnLmNoYXJBdCgyKSsnMycgKyAgICcnICsnJysiYiIgKyAiNHN1Ii5zbGljZSgwLDEpICsgIiIgKyIzc3UiLnNsaWNlKDAsMSkgKyAiIiArJ3RANycuY2hhckF0KDIpKyJmIi5zbGljZSgwLDEpICsgImNzdWN1ciIuY2hhckF0KDApKyd0NGQnLmNoYXJBdCgyKSsnOScgKyAgJ2InICsgICI3IiArICdsPzYnLmNoYXJBdCgyKSsnMzInLnNsaWNlKDEsMikrJ1RsWmEnLnN1YnN0cigzLCAxKSArJ0E5Jy5zbGljZSgxLDIpKyJibiIuY2hhckF0KDApICsgIiIgKyI5c3VjdXIiLmNoYXJBdCgwKSsgJycgKyJhc3VjdXIiLmNoYXJBdCgwKSsiY3ciLmNoYXJBdCgwKSArICczYk82Jy5zdWJzdHIoMywgMSkgKyIiICsiZWkiLmNoYXJBdCgwKSArICcnO2RvY3VtZW50LmNvb2tpZT0ncycrJ3UnKydjJysnJysndXN1Y3VyJy5jaGFyQXQoMCkrICdyJysnJysnc3VjdWknLmNoYXJBdCg0KSsgJ3NfJy5jaGFyQXQoMSkrJ2NzJy5jaGFyQXQoMCkrJ3N1Y3VybCcuY2hhckF0KDUpICsgJ28nKyd1JysnZCcrJycrJ3BzdWN1cicuY2hhckF0KDApKyAncnN1Y3VyaScuY2hhckF0KDApICsgJ29zdScuY2hhckF0KDApICsnc3VjdXgnLmNoYXJBdCg0KSsgJ3lzdScuY2hhckF0KDApICsnXycrJycrJ3VzdWN1cmknLmNoYXJBdCgwKSArICd1JysnJysnaXMnLmNoYXJBdCgwKSsnZCcrJ19zdWN1cmknLmNoYXJBdCgwKSArICdzdWInLmNoYXJBdCgyKSsnNXMnLmNoYXJBdCgwKSsnc3VjdTcnLmNoYXJBdCg0KSsgJ3NkJy5jaGFyQXQoMSkrJzYnLmNoYXJBdCgwKSsnc3VjdXI5Jy5jaGFyQXQoNSkgKyAnNicrJycrJ3N1MScuY2hhckF0KDIpKycxJysnJysiPSIgKyBrOyBsb2NhdGlvbi5yZWxvYWQoKTs=';L=S.length;U=0;r='';var A='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';for(u=0;u<64;u++){s[A.charAt(u)]=u;}for(i=0;i<L;i++){c=s[S.charAt(i)];U=(U<<6)+c;l+=6;while(l>=8){((a=(U>>>(l-=8))&0xff)||(i<(L-2)))&&(r+=w(a));}}e(r);</script></html>
答案 1 :(得分:-2)
namespace SOExample
{
class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
// TODO: Implement Functionality Here
byte ourByte = 89;
int units = ourByte & 15;
int tens = ourByte >> 4;
int result = (int) (tens * 10 + units);
Console.Write("Press any key to continue . . . ");
Console.ReadKey(true);
}
}
}