jstrcspn.gml

来自「开放源码的编译器open watcom 1.6.0版的源代码」· GML 代码 · 共 55 行

GML
55
字号
.func jstrcspn _fjstrcspn
#include <string.h>
size_t jstrcspn( const JCHAR *str,
                 const JCHAR *charset );
.ixfunc2 '&Jstring' &func
.ixfunc2 '&Jsearch' &func
.if &farfnc eq 1 .do begin
size_t __far _fjstrcspn( const JCHAR __far *str,
                         const JCHAR __far *charset );
.ixfunc2 '&Jstring' &ffunc
.ixfunc2 '&Jsearch' &ffunc
.do end
.funcend
.desc begin
.if &farfnc eq 0 .do begin
The &func function computes
.do end
.el .do begin
The &func and &ffunc functions compute
.do end
the length of the initial segment of the Kanji string pointed to by
.arg str
which consists entirely of characters
.us not
from the Kanji string pointed to by
.arg charset.
A double-byte character is treated as one character.
The terminating null character is not considered part of
.arg str.
.im ffarparm
.desc end
.return begin
The length of the initial segment is returned.
.return end
.see begin
.seelist &function. jstrcspn jstrspn strcspn strspn
.see end
.exmp begin
#include <stdio.h>
#include <jstring.h>

void main()
  {
    printf( "%d\n", jstrcspn( "abcbcadef", "cba" ) );
    printf( "%d\n", jstrcspn( "xxxbcadef", "cba" ) );
    printf( "%d\n", jstrcspn( "123456789", "cba" ) );
  }
.exmp output
0
3
9
.exmp end
.class WATCOM
.system

⌨️ 快捷键说明

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