ホーム › Globalization › u_strpbrk
u_strpbrk
関数集合中のいずれかの文字を最初に検索する。
シグネチャ
// icuuc.dll
#include <windows.h>
WORD* u_strpbrk(
const WORD* string,
const WORD* matchSet
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| string | WORD* | in |
| matchSet | WORD* | in |
戻り値の型: WORD*
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
WORD* u_strpbrk(
const WORD* string,
const WORD* matchSet
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr u_strpbrk(
ref ushort string, // WORD*
ref ushort matchSet // WORD*
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function u_strpbrk(
ByRef [string] As UShort, ' WORD*
ByRef matchSet As UShort ' WORD*
) As IntPtr
End Function' string : WORD*
' matchSet : WORD*
Declare PtrSafe Function u_strpbrk Lib "icuuc" ( _
ByRef string As Integer, _
ByRef matchSet As Integer) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
u_strpbrk = ctypes.cdll.icuuc.u_strpbrk
u_strpbrk.restype = ctypes.c_void_p
u_strpbrk.argtypes = [
ctypes.POINTER(ctypes.c_ushort), # string : WORD*
ctypes.POINTER(ctypes.c_ushort), # matchSet : WORD*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
u_strpbrk = Fiddle::Function.new(
lib['u_strpbrk'],
[
Fiddle::TYPE_VOIDP, # string : WORD*
Fiddle::TYPE_VOIDP, # matchSet : WORD*
],
Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn u_strpbrk(
string: *const u16, // WORD*
matchSet: *const u16 // WORD*
) -> *mut u16;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr u_strpbrk(ref ushort string, ref ushort matchSet);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_u_strpbrk' -Namespace Win32 -PassThru
# $api::u_strpbrk(string, matchSet)#uselib "icuuc.dll"
#func global u_strpbrk "u_strpbrk" sptr, sptr
; u_strpbrk varptr(string), varptr(matchSet) ; 戻り値は stat
; string : WORD* -> "sptr"
; matchSet : WORD* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuuc.dll" #cfunc global u_strpbrk "u_strpbrk" var, var ; res = u_strpbrk(string, matchSet) ; string : WORD* -> "var" ; matchSet : WORD* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuuc.dll" #cfunc global u_strpbrk "u_strpbrk" sptr, sptr ; res = u_strpbrk(varptr(string), varptr(matchSet)) ; string : WORD* -> "sptr" ; matchSet : WORD* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; WORD* u_strpbrk(WORD* string, WORD* matchSet) #uselib "icuuc.dll" #cfunc global u_strpbrk "u_strpbrk" var, var ; res = u_strpbrk(string, matchSet) ; string : WORD* -> "var" ; matchSet : WORD* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; WORD* u_strpbrk(WORD* string, WORD* matchSet) #uselib "icuuc.dll" #cfunc global u_strpbrk "u_strpbrk" intptr, intptr ; res = u_strpbrk(varptr(string), varptr(matchSet)) ; string : WORD* -> "intptr" ; matchSet : WORD* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procu_strpbrk = icuuc.NewProc("u_strpbrk")
)
// string (WORD*), matchSet (WORD*)
r1, _, err := procu_strpbrk.Call(
uintptr(string),
uintptr(matchSet),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // WORD*function u_strpbrk(
string: Pointer; // WORD*
matchSet: Pointer // WORD*
): Pointer; cdecl;
external 'icuuc.dll' name 'u_strpbrk';result := DllCall("icuuc\u_strpbrk"
, "Ptr", string ; WORD*
, "Ptr", matchSet ; WORD*
, "Cdecl Ptr") ; return: WORD*●u_strpbrk(string, matchSet) = DLL("icuuc.dll", "void* u_strpbrk(void*, void*)")
# 呼び出し: u_strpbrk(string, matchSet)
# string : WORD* -> "void*"
# matchSet : WORD* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。