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