jstrrchr.c
来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 95 行
C
95 行
/****************************************************************************
*
* 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: jstrrchr 暥帤傪専嶕偡傞
*
* Synopsis: p = jstrrchr( s, c );
*
* JSTRING p; 暥帤偺億僀儞僞
* JSTRING s; 暥帤楍
* JMOJI c; 暥帤
*
* Description: 暥帤楍倱傪弴偵専嶕偟丄嵟弶偵暥帤們偲堦抳偟偨
* 埵抲偺億僀儞僞傪曉偡丅倞倱倲倰們倛倰偼愭摢偐傜
* 専嶕偟丄倞倱倲倰倰們倛倰偼嵟屻偐傜専嶕偡傞丅
*
* Returns: 堦抳偑側偐偭偨応崌偼僰儖億僀儞僞傪曉偡丅
*
*
* Name: jstrrchr search out specified letter from the string
*
* Synopsis: p = jstrrchr( s, c );
*
* JSTRING p; return value which point to the searched out
* letter
* JSTRING s; pointer to the string which is referenced
* JMOJI c; the value of searching letter
*
* Description: The jstrrchr function locates the final occurrence of "c"
* in the string pointed to by "s". Jstrrchr function start to
* search out from the end of string, and jstrchr function
* start to search out from the top of string.
* If you specify "c" with KANJI letter, JMOJI consist with 16
* bit and its' high byte consist with first byte code of KANJI
* letter, and low byte consist with second byte code of KANJI
* letter. If second byte code is NULL then the first byte code
* also consider to NULL. If you specify "c" with 1 byte character
* then, it must be in the low byte of JMOJI and the high byte of
* JMOJI has to NULL.
*
* Returns: This function returns a pointer to the located letter, or NULL
* if the letter does not occur in the string.
*
**/
_WCRTLINK JSTRING jstrrchr( const JCHAR *s, JMOJI c )
{
const JCHAR *p, *ss;
JMOJI cc;
p = (JSTRING)NULL;
while( 1 ) {
ss = jgetmoji( s, &cc );
if( cc == 0 ) break;
if( cc == c ) p = s;
s = ss;
}
return( (JSTRING) p );
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?