cutils.c

来自「彩信MMS的全部代码」· C语言 代码 · 共 128 行

C
128
字号
/*
 * Copyright (C) Obigo AB, 2002-2005.
 * All rights reserved.
 *
 * This software is covered by the license agreement between
 * the end user and Obigo AB, and may be 
 * used and copied only in accordance with the terms of the 
 * said agreement.
 *
 * Obigo AB assumes no responsibility or 
 * liability for any errors or inaccuracies in this software, 
 * or any consequential, incidental or indirect damage arising
 * out of the use of the software.
 *
 */

















#include "cansilib.h"   
#include "chartype.h"   
#include "cutils.h"     
#include "chartype.h"   




























int cmnStrcmpNc(const char *str1, const char *str2)
{
    
    while (*str1 && *str2 && CMN_TOLOWER(*str1) == CMN_TOLOWER(*str2))
    {
        ++str1;
        ++str2;
    } 

    
    return *str1 == *str2 ? 0 : (*str1 < *str2 ? -1 : 1);
} 












unsigned long cmnStrnlen(const char *str, unsigned long length)
{
    unsigned long i = 0;

    for ( i = 0; i < length && *str++; ++i)
    {
        
    } 

    return i;
} 







int cmnIsDigits (const char* str)
{
    unsigned len;
    unsigned i;
    
    if (!str)
    {
        return 0;
    }
    
    len = strlen(str);
    for (i = 0; i < len; i++)
    {
        if (!CMN_ISDIGIT(str[i]))
        {
            return 0;
        }
    }
    
    return 1;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?