fjstrspn.c
来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 92 行
C
92 行
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: WHEN YOU FIGURE OUT WHAT THIS FILE DOES, PLEASE
* DESCRIBE IT HERE!
*
****************************************************************************/
#include "variety.h"
#include <jstring.h>
/**
*
* Name: _fjstrspn
*
* Synopsis: unsigned int _fjstrspn( JSTRING str1, JSTRING str2 );
*
* JSTRING str1; 僒乕僠偝傟傞暥帤楍
* JSTRING str2; str1 偺拞偐傜僒乕僠偡傞暥帤偺廤崌
* unsigned ret; str2 偱巜掕偟偨暥帤偵堦抳偟側偄嵟弶偺暥帤傪
* 巜偡僀儞僨僢僋僗
*
* Description: _fjstrspn 娭悢偼, 暥帤楍 str1 偺拞偐傜丄暥帤楍 str2 偱巜掕偟偨
* 暥帤楍拞偺偄偢傟偺暥帤偲傕堦抳偟側偄丄嵟弶偺暥帤傪巜偡
* 僀儞僨僢僋僗傪曉偟傑偡丅str1 偺愭摢偐傜栠傝抣偑帵偡僶僀僩悢暘
* 偼丄str2 偱巜掕偟偨暥帤楍拞偺暥帤偩偗偱峔惉偝傟偰偄傞偙偲傪
* 堄枴偟傑偡丅str1 偑 str2 偱巜掕偟偨暥帤埲奜偱巒傑偭偰偄傞
* 偲偒偼丄0 傪曉偟傑偡丅
*
* Name: _fjstrspn
*
* Synopsis: ret = _fjstrspn( str1, str2 );
*
* JSTRING str1; 2-byte KANJI string
* JSTRING str2; 2-byte KANJI characters
* unsigned ret; Index to the first character in string str1
* which does not consist of string str2.
*
* Description: _fjstrspn function returns the index to the first character in
* thestrinf str1 which is not included in the string str2.
* In the other words, The string from the head of the string
* str1 through the ret bytes is consists of the characters in
* the string str2. This function is a data independent form
* that accept far pointer argunments. It is most useful in mix
* memory model applications.
*
* Return: If the string str1 starts with a character which is not
* included in the string str2, this function returns 0.
*
**/
_WCRTLINK size_t _WCI86FAR _fjstrspn( const JCHAR _WCFAR *str1, const JCHAR _WCFAR *str2 )
{
const JCHAR _WCFAR *s2;
JMOJI c1, c2;
size_t count;
for( count = 0;
str1 = _fjgetmoji( str1, ( JMOJI _WCFAR * )&c1 ), c1;
++count ) {
for( s2 = str2;
( s2 = _fjgetmoji( s2, ( JMOJI _WCFAR * )&c2 ), c2 ) && ( c1 != c2 );
);
if( !c2 ) break;
}
return count;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?