Win32 API 日本語リファレンス
ホームGlobalization › u_strCaseCompare

u_strCaseCompare

関数
大文字小文字を無視して二つの文字列を比較する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

// icuuc.dll
#include <windows.h>

INT u_strCaseCompare(
    const WORD* s1,
    INT length1,
    const WORD* s2,
    INT length2,
    DWORD options,
    UErrorCode* pErrorCode
);

パラメーター

名前方向
s1WORD*in
length1INTin
s2WORD*in
length2INTin
optionsDWORDin
pErrorCodeUErrorCode*inout

戻り値の型: INT

各言語での呼び出し定義

// icuuc.dll
#include <windows.h>

INT u_strCaseCompare(
    const WORD* s1,
    INT length1,
    const WORD* s2,
    INT length2,
    DWORD options,
    UErrorCode* pErrorCode
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int u_strCaseCompare(
    ref ushort s1,   // WORD*
    int length1,   // INT
    ref ushort s2,   // WORD*
    int length2,   // INT
    uint options,   // DWORD
    ref int pErrorCode   // UErrorCode* in/out
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function u_strCaseCompare(
    ByRef s1 As UShort,   ' WORD*
    length1 As Integer,   ' INT
    ByRef s2 As UShort,   ' WORD*
    length2 As Integer,   ' INT
    options As UInteger,   ' DWORD
    ByRef pErrorCode As Integer   ' UErrorCode* in/out
) As Integer
End Function
' s1 : WORD*
' length1 : INT
' s2 : WORD*
' length2 : INT
' options : DWORD
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Function u_strCaseCompare Lib "icuuc" ( _
    ByRef s1 As Integer, _
    ByVal length1 As Long, _
    ByRef s2 As Integer, _
    ByVal length2 As Long, _
    ByVal options As Long, _
    ByRef pErrorCode As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

u_strCaseCompare = ctypes.cdll.icuuc.u_strCaseCompare
u_strCaseCompare.restype = ctypes.c_int
u_strCaseCompare.argtypes = [
    ctypes.POINTER(ctypes.c_ushort),  # s1 : WORD*
    ctypes.c_int,  # length1 : INT
    ctypes.POINTER(ctypes.c_ushort),  # s2 : WORD*
    ctypes.c_int,  # length2 : INT
    wintypes.DWORD,  # options : DWORD
    ctypes.c_void_p,  # pErrorCode : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
u_strCaseCompare = Fiddle::Function.new(
  lib['u_strCaseCompare'],
  [
    Fiddle::TYPE_VOIDP,  # s1 : WORD*
    Fiddle::TYPE_INT,  # length1 : INT
    Fiddle::TYPE_VOIDP,  # s2 : WORD*
    Fiddle::TYPE_INT,  # length2 : INT
    -Fiddle::TYPE_INT,  # options : DWORD
    Fiddle::TYPE_VOIDP,  # pErrorCode : UErrorCode* in/out
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn u_strCaseCompare(
        s1: *const u16,  // WORD*
        length1: i32,  // INT
        s2: *const u16,  // WORD*
        length2: i32,  // INT
        options: u32,  // DWORD
        pErrorCode: *mut i32  // UErrorCode* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int u_strCaseCompare(ref ushort s1, int length1, ref ushort s2, int length2, uint options, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_u_strCaseCompare' -Namespace Win32 -PassThru
# $api::u_strCaseCompare(s1, length1, s2, length2, options, pErrorCode)
#uselib "icuuc.dll"
#func global u_strCaseCompare "u_strCaseCompare" sptr, sptr, sptr, sptr, sptr, sptr
; u_strCaseCompare varptr(s1), length1, varptr(s2), length2, options, pErrorCode   ; 戻り値は stat
; s1 : WORD* -> "sptr"
; length1 : INT -> "sptr"
; s2 : WORD* -> "sptr"
; length2 : INT -> "sptr"
; options : DWORD -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuuc.dll"
#cfunc global u_strCaseCompare "u_strCaseCompare" var, int, var, int, int, int
; res = u_strCaseCompare(s1, length1, s2, length2, options, pErrorCode)
; s1 : WORD* -> "var"
; length1 : INT -> "int"
; s2 : WORD* -> "var"
; length2 : INT -> "int"
; options : DWORD -> "int"
; pErrorCode : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT u_strCaseCompare(WORD* s1, INT length1, WORD* s2, INT length2, DWORD options, UErrorCode* pErrorCode)
#uselib "icuuc.dll"
#cfunc global u_strCaseCompare "u_strCaseCompare" var, int, var, int, int, int
; res = u_strCaseCompare(s1, length1, s2, length2, options, pErrorCode)
; s1 : WORD* -> "var"
; length1 : INT -> "int"
; s2 : WORD* -> "var"
; length2 : INT -> "int"
; options : DWORD -> "int"
; pErrorCode : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procu_strCaseCompare = icuuc.NewProc("u_strCaseCompare")
)

// s1 (WORD*), length1 (INT), s2 (WORD*), length2 (INT), options (DWORD), pErrorCode (UErrorCode* in/out)
r1, _, err := procu_strCaseCompare.Call(
	uintptr(s1),
	uintptr(length1),
	uintptr(s2),
	uintptr(length2),
	uintptr(options),
	uintptr(pErrorCode),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function u_strCaseCompare(
  s1: Pointer;   // WORD*
  length1: Integer;   // INT
  s2: Pointer;   // WORD*
  length2: Integer;   // INT
  options: DWORD;   // DWORD
  pErrorCode: Pointer   // UErrorCode* in/out
): Integer; cdecl;
  external 'icuuc.dll' name 'u_strCaseCompare';
result := DllCall("icuuc\u_strCaseCompare"
    , "Ptr", s1   ; WORD*
    , "Int", length1   ; INT
    , "Ptr", s2   ; WORD*
    , "Int", length2   ; INT
    , "UInt", options   ; DWORD
    , "Ptr", pErrorCode   ; UErrorCode* in/out
    , "Cdecl Int")   ; return: INT
●u_strCaseCompare(s1, length1, s2, length2, options, pErrorCode) = DLL("icuuc.dll", "int u_strCaseCompare(void*, int, void*, int, dword, void*)")
# 呼び出し: u_strCaseCompare(s1, length1, s2, length2, options, pErrorCode)
# s1 : WORD* -> "void*"
# length1 : INT -> "int"
# s2 : WORD* -> "void*"
# length2 : INT -> "int"
# options : DWORD -> "dword"
# pErrorCode : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。