Public SCA1() As String Public SCA2() As Long Public SEL1() As String Public SEL2() As Long Sub MAIN() Call IVDINI(A) Cells(2, 2).VALUE = "通常" Cells(3, 2).VALUE = "サロゲートペア" Cells(4, 2).VALUE = "通常異体字" Cells(5, 2).VALUE = "サロゲートペア異体字" Cells(6, 2).VALUE = "結合文字" Cells(7, 2).VALUE = "有るセレクタ" Cells(8, 2).VALUE = "嘘のセレクタ" Cells(2, 4).VALUE = "折" Cells(3, 4).VALUE = uni2(55405, 57158) Cells(4, 4).VALUE = uni3(33883, 56128, 56576) Cells(5, 4).VALUE = uni4(55362, 57247, 56128, 56576) Cells(6, 4).VALUE = uni5(9977, 65039, 8205, 9792, 65039) Cells(7, 4).VALUE = uni4(55399, 56893, 56128, 56577) Cells(8, 4).VALUE = uni4(55399, 56893, 56128, 56586) For y = 2 To 8 Cells(y, 3).FormulaR1C1 = "=IsIVSHEXSCAL(RC[1])" Next End Sub Function IsIVSHEXSCAL(ByVal VALUE) 'http://d.hatena.ne.jp/replication/20091016/1255704497 Dim bytes, intI, firstByte, secondByte Dim SEL As Long Dim SELU As String Dim IVSByte() As Long Dim c As Long bytes = LenB(VALUE) ' バイト数を取得する ReDim IVSByte(Int(bytes / 2) + 1) ' バイト数だけ繰り返し IsIVSHEXSCAL = "" For intI = 1 To bytes Step 2 ' 2バイトずつ取り出し IVSByte(Int(intI / 2)) = AscW(MidB(VALUE, intI, 2)) ' 最後のバイトの場合は、secondByteに0を格納する If intI + 2 < bytes Then IVSByte(Int(intI / 2) + 1) = AscW(MidB(VALUE, intI + 2, 2)) Else IVSByte(Int(intI / 2) + 1) = 0 End If IsIVSHEXSCAL = IsIVSHEXSCAL & "U+" & Application.Dec2Hex(ASCW2(IVSByte(Int(intI / 2))), 4) & "," Next c = Application.WorksheetFunction.unicode(VALUE) '異体字セレクタの確認 'http://mrxray.on.coocan.jp/Delphi/Others/SurrogatePair.htm If UBound(IVSByte, 1) > 2 Then If IVSByte(UBound(IVSByte, 1) - 3) = -9408 Then '上位ワードは U + DB40 の固定値 SEL = Application.Hex2Dec("E0100") + IVSByte(UBound(IVSByte, 1) - 2) + 8960 'U + E0100 ~ U + E01EF SELU = ",U+" & Application.Dec2Hex(SEL) & IVD(c, (IVSByte(UBound(IVSByte, 1) - 2) + 8960)) Else SELU = "" End If Else SELU = "" End If 'https://www.moug.net/tech/exvba/0100035.html IsIVSHEXSCAL = "(" & "U+" & Application.Dec2Hex(c, 6) & SELU & ")" & IsIVSHEXSCAL End Function