• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ IsDigit函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中IsDigit函数的典型用法代码示例。如果您正苦于以下问题:C++ IsDigit函数的具体用法?C++ IsDigit怎么用?C++ IsDigit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了IsDigit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: remove_unknown

/* remove_unknown()
 *
 * inputs	- client who gave us message, supposed sender, buffer
 * output	-
 * side effects	- kills issued for clients, squits for servers
 */
static void
remove_unknown(struct Client *client_p, const char *lsender, char *lbuffer)
{
	int slen = strlen(lsender);
	char sid[4];
	struct Client *server;

	/* meepfoo	is a nickname (ignore)
	 * #XXXXXXXX	is a UID (KILL)
	 * #XX		is a SID (SQUIT)
	 * meep.foo	is a server (SQUIT)
	 */
	if((IsDigit(lsender[0]) && slen == 3) ||
	   (strchr(lsender, '.') != NULL))
	{
		sendto_realops_snomask(SNO_DEBUG, L_ALL,
				     "Unknown prefix (%s) from %s, Squitting %s",
				     lbuffer, client_p->name, lsender);

		sendto_one(client_p,
			   ":%s SQUIT %s :(Unknown prefix (%s) from %s)",
			   get_id(&me, client_p), lsender,
			   lbuffer, client_p->name);
	}
	else if(!IsDigit(lsender[0]))
		;
	else if(slen != 9)
		sendto_realops_snomask(SNO_DEBUG, L_ALL,
				     "Invalid prefix (%s) from %s",
				     lbuffer, client_p->name);
	else
	{
		memcpy(sid, lsender, 3);
		sid[3] = '\0';
		server = find_server(NULL, sid);
		if (server != NULL && server->from == client_p)
			sendto_one(client_p, ":%s KILL %s :%s (Unknown Client)",
					get_id(&me, client_p), lsender, me.name);
	}
}
开发者ID:kamilion,项目名称:charybdis,代码行数:46,代码来源:parse.c


示例2: VolNameToFirstName

// Get the name of first volume. Return the leftmost digit of volume number.
wchar* VolNameToFirstName(const wchar *VolName,wchar *FirstName,size_t MaxSize,bool NewNumbering)
{
  if (FirstName!=VolName)
    wcsncpyz(FirstName,VolName,MaxSize);
  wchar *VolNumStart=FirstName;
  if (NewNumbering)
  {
    wchar N='1';

    // From the rightmost digit of volume number to the left.
    for (wchar *ChPtr=GetVolNumPart(FirstName);ChPtr>FirstName;ChPtr--)
      if (IsDigit(*ChPtr))
      {
        *ChPtr=N; // Set the rightmost digit to '1' and others to '0'.
        N='0';
      }
      else
        if (N=='0')
        {
          VolNumStart=ChPtr+1; // Store the position of leftmost digit in volume number.
          break;
        }
  }
  else
  {
    // Old volume numbering scheme. Just set the extension to ".rar".
    SetExt(FirstName,L"rar",MaxSize);
    VolNumStart=GetExt(FirstName);
  }
  if (!FileExist(FirstName))
  {
    // If the first volume, which name we just generated, is not exist,
    // check if volume with same name and any other extension is available.
    // It can help in case of *.exe or *.sfx first volume.
    wchar Mask[NM];
    wcsncpyz(Mask,FirstName,ASIZE(Mask));
    SetExt(Mask,L"*",ASIZE(Mask));
    FindFile Find;
    Find.SetMask(Mask);
    FindData FD;
    while (Find.Next(&FD))
    {
      Archive Arc;
      if (Arc.Open(FD.Name,0) && Arc.IsArchive(true) && Arc.FirstVolume)
      {
        wcsncpyz(FirstName,FD.Name,MaxSize);
        break;
      }
    }
  }
  return VolNumStart;
}
开发者ID:KyleSanderson,项目名称:mpc-hc,代码行数:53,代码来源:pathfn.cpp


示例3: while

Stack<Error>* Corrector::CheckExpression(Lexema *input) {
	int i = 0;
	int count_bracket = 0;
	while (input[i].GetType() != Type_Lexems::terminal) {
		if (IsDigit(input[i])) {
			if(IsDigitRight(input[i]) == false){
				AddError(input[i].GetPosition(), "Ошибка в числе. Позиция ошибки: ");
			}
		}
		if (IsBinaryOperaion(input[i]))
		{
			if (input[i+1].GetType() == Type_Lexems::terminal)
			{
				AddError(input[i].GetPosition(), "Ошибка в бинарной операции. Позиция ошибки: ");
			}
			if (input[i + 1].GetType() != Type_Lexems::terminal && IsBinaryOperaion(input[i+1])) {
				AddError(input[i].GetPosition(), "Ошибка в повторе бинарной операций. Позиция ошибки: ");
			}
			if (input[i + 1].GetType() != Type_Lexems::terminal && input[i + 1].GetType() == Type_Lexems::close_bracket) {
				AddError(input[i].GetPosition(), "Ошибка в бинарной операции, пропущен аргумент. Позиция ошибки: ");
			}
		}
		if (IsOperationUnary(input[i]))
		{
			if (input[i + 1].GetType() == Type_Lexems::terminal) {
				AddError(input[i].GetPosition(), "Ошибка в унарной операции. Позиция ошибки: ");
			}
			if (input[i + 1].GetType() != Type_Lexems::terminal && input[i + 1].GetType() == Type_Lexems::close_bracket)
			{
				AddError(input[i].GetPosition(), "Ошибка в унарной операции, пропущен аргумент. Позиция ошибки: ");
			}
		}
		if (IsOpenBracket(input[i]))
		{
			count_bracket++;
		}
		if (IsCloseBracket(input[i]))
		{
			count_bracket--;
			if (count_bracket<0)
			{
				AddError(input[i].GetPosition(), "Ошибка в закрывающей скобке. Позиция ошибки: ");
			}
		}
		i++;
	}
	if (count_bracket != 0)
	{
		AddError("Ошибка в скобках.");
	}
	return &errors;
}
开发者ID:SemenBevzuk,项目名称:mp2-lab3-arithmetic,代码行数:52,代码来源:corrector.cpp


示例4: xl_eval

static int xl_eval(definition *def_ptr, char *val)
{
	if (!val)
		panic("Null value found in evaluation!");
	if (IsDigit(val[0])) {
		if (val[0] == '~')
			return ~xl_eval(def_ptr, &val[1]);
		if (val[1] == '-')
			return -xl_eval(def_ptr, &val[1]);
		if ((val[0] == '0') && (val[1] == 'x')) {
			/* Hexadecimal. */
			int num = 0;
			int pos = 2;
			
			while (val[pos]) {
				num = num << 4;
				if (isdigit(((int) val[pos])))
					num += (val[pos] - '0');
				else {
					num += (((val[pos] - 'A') & 0x1f)
						+ 10);
					if ((val[pos] < 'A')
					    || (val[pos] > 'f'))
						panic(("Invalid hex value "
						       "`%s'."),
						      val);
					if ((val[pos] & 0x1f) > 5)
						panic(("Invalid hex value "
						       "`%s'."),
						      val);
				}
				pos++;
			}
			return num;
		} else
			return atoi(val);
		
	} else {
		int ref = aoi_name(def_ptr, val, NO_CREATE);
		aoi_type bind = outaoi.defs.defs_val[ref].binding;
		
		if (ref < 0)
			panic("Undefined const `%s'.", val);
		if (bind->kind != AOI_CONST)
			panic("Invalid type found in evaluation.");
		if (bind->aoi_type_u_u.const_def.value->kind != AOI_CONST_INT)
			panic("Invalid const type found in evaluation.");
		
		return (bind->aoi_type_u_u.const_def.value->aoi_const_u_u.
			const_int);
	}
}
开发者ID:berkus,项目名称:flick,代码行数:52,代码来源:xlate.c


示例5: MeasureTokenLength

	void MeasureTokenLength()
	{
		if(IsNameChar(*m_pNext))
		{
			for(m_len = 1; IsNameChar(m_pNext[m_len]) || IsDigit(m_pNext[m_len]); m_len++)
			{
			}
			m_type = name;
		}
		else if(IsDigit(*m_pNext) || *m_pNext == '.')
		{
			int exps = 0;
			int decimals = 0;
			if(*m_pNext == '.')
				decimals++;
			for(m_len = 1; m_pNext[m_len] != '\0'; m_len++)
			{
				if(IsDigit(m_pNext[m_len]))
					continue;
				if(m_pNext[m_len] == '.' && decimals == 0 && exps == 0)
				{
					decimals++;
					continue;
				}
				if(m_pNext[m_len] == 'e' && IsDigit(m_pNext[m_len + 1]) && exps == 0)
				{
					exps++;
					continue;
				}
				break;
			}
			m_type = number;
		}
		else
		{
			m_len = 1;
			m_type = symbol;
		}
	}
开发者ID:kslazarev,项目名称:waffles,代码行数:39,代码来源:GFunction.cpp


示例6: GetNum

char GetNum()
{
    char c = Look;

    if( !IsDigit(Look)) {
        sprintf(tmp, "Integer");
        Expected(tmp);
    }

    GetChar();

    return c;
}
开发者ID:GoAwayPeter,项目名称:BasicParser,代码行数:13,代码来源:cradle.c


示例7: return

bool CSocketAddressIP::SetHostStr( LPCTSTR pszHostName )
{
	// try to resolve the host name with DNS for the true ip address.
	if ( pszHostName[0] == '\0' )
		return( false );
	if ( IsDigit( pszHostName[0] ))
	{
		SetAddrStr( pszHostName ); // 0.1.2.3
		return( true );
	}
	// NOTE: This is a blocking call !!!!
	return SetHostStruct( gethostbyname( pszHostName ));
}
开发者ID:MortalROs,项目名称:Source,代码行数:13,代码来源:CSocket.cpp


示例8: ParseSeqId

// The <seq-id> is a sequence number in base 36,
// using digits and upper case letters
static bool ParseSeqId(State *state) {
  const char *p = state->mangled_cur;
  for (;*p != '\0'; ++p) {
    if (!IsDigit(*p) && !(*p >= 'A' && *p <= 'Z')) {
      break;
    }
  }
  if (p != state->mangled_cur) {  // Conversion succeeded.
    state->mangled_cur = p;
    return true;
  }
  return false;
}
开发者ID:lengerrong,项目名称:SimpleMallocTrace,代码行数:15,代码来源:Demangle.cpp


示例9: Asn1ToDate

Date Asn1ToDate(ASN1_STRING *time)
{
	if(!time) return Null;
	int digit = 0;
	while(digit < time->length && IsDigit(time->data[digit]))
		digit++;
	if(digit < 6)
		return Null;
	int year2 = time->data[0] * 10 + time->data[1] - 11 * '0';
	int month = time->data[2] * 10 + time->data[3] - 11 * '0';
	int day   = time->data[4] * 10 + time->data[5] - 11 * '0';
	return Date(year2 + (year2 < 90 ? 2000 : 1900), month, day);
}
开发者ID:koz4k,项目名称:soccer,代码行数:13,代码来源:Util.cpp


示例10: operator

	virtual bool operator()(int pos, const RichPara& para)// A++ bug here....
	{
		if(!IsNull(para.format.label)) {
			AddLinkRef(link, para.format.label);
			ref.FindAdd(para.format.label);
		}
		for(int i = 0; i < para.part.GetCount(); i++)
			if(para.part[i].IsText()) {
				const wchar *s = para.part[i].text;
				for(;;) {
					while(!IsLetter(*s) && !IsDigit(*s) && *s)
						s++;
					if(*s == '\0')
						break;
					StringBuffer sb;
					while(IsLetter(*s) || IsDigit(*s))
						sb.Cat(ToAscii(ToLower(*s++)));
					words.FindAdd(TopicWordIndex(sb));
				}
			}
		return false;
	}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:22,代码来源:TopicBase.cpp


示例11: ParseDigits

static int ParseDigits(char **ppText)
{
	char *p=*ppText;
	int Value=0;

	SkipSpaces(&p);
	while (IsDigit(*p)) {
		Value=Value*10+(*p-'0');
		p++;
	}
	*ppText=p;
	return Value;
}
开发者ID:ChenglongWang,项目名称:TVTest,代码行数:13,代码来源:ChannelList.cpp


示例12: IsStrNumericDec

bool IsStrNumericDec( lpctstr pszTest )
{
	if ( !pszTest || !*pszTest )
		return false;

	do
	{
		if ( !IsDigit(*pszTest) )
			return false;
	}
	while ( *(++pszTest) );

	return true;
}
开发者ID:Sphereserver,项目名称:Source2,代码行数:14,代码来源:CExpression.cpp


示例13: ReadString

	JsonValue * JsonParser::ReadValue(JsonValue * parent)
	{
		if (*cur_ == '"')
		{
			return ReadString(parent);
		}
		else if (IsDigit(*cur_) || *cur_ == '-')
		{
			return ReadNumber(parent);
		}
		else if (IsAlpha(*cur_))
		{
			std::string keyword;
			ParseIdentifier(keyword);

			if (keyword == "null")
			{
				return 0;
			}
			if (keyword == "true")
			{
				return new JsonBooleanValue(parent, true);
			}
			else if (keyword == "false")
			{
				return new JsonBooleanValue(parent, false);
			}
			else
			{
				throw Error(
					row_,
					column_ - keyword.length(),
					FormatString("Invalid bareword \"%s\", while value expected", keyword.c_str())
				);
			}
		}
		else if (*cur_ == '[')
		{
			return ReadArray(parent);
		}
		else if (*cur_ == '{')
		{
			return ReadObject(parent);
		}
		else
		{
			RaiseError("Invalid symbol, while value expected");
			return 0;
		}
	}
开发者ID:haroldzmli,项目名称:cuboid,代码行数:50,代码来源:JsonParser.cpp


示例14: Factor

// <factor>          ::= <number_literal> | <identifier> | ( <bool_expression> )
void Factor(CPU *cpu, Files file){
    if(Peek('(', file)){
        Match('(', file);
        Boolean::Expression(cpu, file);
        Match(')', file);
    }
    else if(IsDigit(Peek())){
        cpu->LoadNumber(GetNumber(file));
    }
    else if(IsAlpha(Peek()))
        Identifier(cpu, file);
    else
        Abort("Internal Error. FIXME!", file);
}
开发者ID:FlyingJester,项目名称:EmeraldC,代码行数:15,代码来源:math_expression.cpp


示例15: SetupLexer

void SetupLexer()
{
	int i;

	for (i = 0; i < END_OF_FILE + 1; i++)
	{
		if (IsLetter(i))
		{
			Scanners[i] = ScanIdentifier;
		}
		else if (IsDigit(i))
		{
			Scanners[i] = ScanNumericLiteral;
		}
		else
		{
			Scanners[i] = ScanBadChar;
		}
	}

	Scanners[END_OF_FILE] = ScanEOF;
	Scanners['\''] = ScanCharLiteral;
	Scanners['"']  = ScanStringLiteral;
	Scanners['+']  = ScanPlus;
	Scanners['-']  = ScanMinus;
	Scanners['*']  = ScanStar;
	Scanners['/']  = ScanSlash;
    Scanners['%']  = ScanPercent;
	Scanners['<']  = ScanLess;
	Scanners['>']  = ScanGreat;
	Scanners['!']  = ScanExclamation;
	Scanners['=']  = ScanEqual;
	Scanners['|']  = ScanBar;
	Scanners['&']  = ScanAmpersand;
	Scanners['^']  = ScanCaret;
	Scanners['.']  = ScanDot;
	Scanners['{']  = ScanLBRACE;
	Scanners['}']  = ScanRBRACE;
	Scanners['[']  = ScanLBRACKET;
	Scanners[']']  = ScanRBRACKET;
	Scanners['(']  = ScanLPAREN;
	Scanners[')']  = ScanRPAREN;
	Scanners[',']  = ScanCOMMA;
	Scanners[';']  = ScanSEMICOLON;
	Scanners['~']  = ScanCOMP;
	Scanners['?']  = ScanQUESTION;
	Scanners[':']  = ScanCOLON;
	Scanners['#']  = ScanHASH;
    Scanners['\n'] = ScanNewLine;
}
开发者ID:gyc2015,项目名称:GYC,代码行数:50,代码来源:lex.c


示例16: remove_unknown

/* remove_unknown()
 *
 * inputs	- client who gave us message, supposed sender, buffer
 * output	- 
 * side effects	- kills issued for clients, squits for servers
 */
static void
remove_unknown(struct Client *client_p, char *lsender, char *lbuffer)
{
	int slen = strlen(lsender);

	/* meepfoo      is a nickname (ignore)
	 * #XXXXXXXX    is a UID (KILL)
	 * #XX          is a SID (SQUIT)
	 * meep.foo     is a server (SQUIT)
	 */
	if((IsDigit(lsender[0]) && slen == 3) || (strchr(lsender, '.') != NULL))
	{
		sendto_realops_flags(UMODE_DEBUG, L_ALL,
				     "Unknown prefix (%s) from %s, Squitting %s",
				     lbuffer, client_p->name, lsender);

		sendto_one(client_p, ":%s SQUIT %s :(Unknown prefix (%s) from %s)",
			   get_id(&me, client_p), lsender, lbuffer, client_p->name);
	}
	else if(IsDigit(lsender[0]))
		sendto_one(client_p, ":%s KILL %s :%s (Unknown Client)",
			   get_id(&me, client_p), lsender, me.name);
}
开发者ID:Cloudxtreme,项目名称:ircd-ratbox-1,代码行数:29,代码来源:parse.c


示例17: HexVal

unsigned HexVal (int C)
/* Convert a hex digit into a value. The function will emit an error for
 * invalid hex digits.
 */
{
    if (!IsXDigit (C)) {
        Error ("Invalid hexadecimal digit: `%c'", C);
    }
    if (IsDigit (C)) {
        return C - '0';
    } else {
        return toupper (C) - 'A' + 10;
    }
}
开发者ID:PanchoManera,项目名称:cc65,代码行数:14,代码来源:hexval.c


示例18: do_nick_name

static int do_nick_name(char *nick) {
  char   *ch;
  
  if (*nick == '-' || IsDigit(*nick))	/* first character is [0..9-] */
      return 0;
  
  for (ch = nick; *ch && (ch - nick) < NICKLEN; ch++)
      if (!isvalid(*ch) || IsSpace(*ch))
	  break;
  
  *ch = '\0';
  
  return (ch - nick);
}
开发者ID:Apsu,项目名称:bahamut,代码行数:14,代码来源:m_nick.c


示例19: OptSub3

unsigned OptSub3 (CodeSeg* S)
/* Search for a call to decaxn and replace it by an 8 bit sub if the X register
** is not used later.
*/
{
    unsigned Changes = 0;

    /* Walk over the entries */
    unsigned I = 0;
    while (I < CS_GetEntryCount (S)) {

        CodeEntry* E;

        /* Get next entry */
        E = CS_GetEntry (S, I);

        /* Check for the sequence */
        if (E->OPC == OP65_JSR                          &&
            strncmp (E->Arg, "decax", 5) == 0           &&
            IsDigit (E->Arg[5])                         &&
            E->Arg[6] == '\0'                           &&
            !RegXUsed (S, I+1)) {

            CodeEntry* X;
            const char* Arg;

            /* Insert new code behind the sequence */
            X = NewCodeEntry (OP65_SEC, AM65_IMP, 0, 0, E->LI);
            CS_InsertEntry (S, X, I+1);

            Arg = MakeHexArg (E->Arg[5] - '0');
            X = NewCodeEntry (OP65_SBC, AM65_IMM, Arg, 0, E->LI);
            CS_InsertEntry (S, X, I+2);

            /* Delete the old code */
            CS_DelEntry (S, I);

            /* Remember, we had changes */
            ++Changes;

        }

        /* Next entry */
        ++I;

    }

    /* Return the number of changes made */
    return Changes;
}
开发者ID:Aliandrana,项目名称:cc65,代码行数:50,代码来源:coptsub.c


示例20: ScanNumericLiteral

static int ScanNumericLiteral()
{
    int base = 10;
    if('.' == *CURSOR)
    {
        return ScanFloatLiteral();
    }

    if('0' == *CURSOR && (CURSOR[1] == 'x'|| CURSOR[1] == 'X'))
    {
        base = 16;
        CURSOR += 2;
        while(IsHexDigit(*CURSOR))
        {
            CURSOR++;
        }
    }
    else if('0' == *CURSOR)
    {
        base = 8;
        CURSOR++;
        while(IsOctDigit(*CURSOR))
        {
            CURSOR++;
        }
    }
    else
    {
        CURSOR++;
        while(IsDigit(*CURSOR))
        {
            CURSOR++;
        }
    }

    if(base == 16 || (*CURSOR == '.' && *CURSOR == 'e' && *CURSOR == 'E'))
    {
        while('u' == *CURSOR || 'U' == *CURSOR ||
              'l' == *CURSOR || 'L' == *CURSOR)
        {
            CURSOR++;
        }
        return TK_INTCONST;
    }
    else
    {
        return ScanFloatLiteral();
    }
}
开发者ID:gyc2015,项目名称:GYC,代码行数:49,代码来源:lex.c



注:本文中的IsDigit函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IsDir函数代码示例发布时间:2022-05-30
下一篇:
C++ IsDialogMessage函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap