• 쇼핑몰
  • 커뮤니티
  • 북마크

vb6.0/vba




[vb6.0/vba] [vb6.0/vba]유니코드를 일반 문자열로 변환시켜주는 vb6.0/vba 사용자 함수

하나를하더라도최선을
2020.04.10 01:54 479 0

본문



API를 사용하거나 웹 파싱을 하다보면 유니코드 부호로 변환되어 저장이 돼 있는 경우가 종종 있습니다.

Function UnicodeToString(Text As String) As String

Dim V As Variant, str As String

Dim T As String, tem As String, ret As String

On Error Resume Next

For Each V In Split(Text, "\u")

If Len(V) >= 4 Then

tem = Right(V, Len(V) - 4)

str = ToString(Left(V, 4))

ret = ret & str & tem

Else

ret = ret & V

End If

Next

UnicodeToString = ret

End Function

Function ToString(Text As String) As String

On Error GoTo ErrPass

ToString = ChrW("&H" & Text)

Exit Function

ErrPass:

ToString = Text

End Function

ex:)

T = UnicodeToString("{""meta"":{""is_end"":true,""total_count"":1,""pageable_count"":1},""documents"":[{""road_addres" & _

"s"":{""undergroun_yn"":""N"",""road_name"":""\uc554\uc0ac1\uac00\uae38"",""underground_yn"":""N"",""regio" & _

"n_2depth_name"":""\uac15\ub3d9\uad6c"",""zone_no"":""05251"",""sub_building_no"":"""",""region_3depth_nam" & _

"e"":""\uc554\uc0ac\ub3d9"",""main_building_no"":""37"",""address_name"":""\uc11c\uc6b8 \uac15\ub3d9\uad6c \u" & _

"c554\uc0ac1\uac00\uae38 37"",""y"":""37.55308926323607"",""x"":""127.13071108150956"",""region_1depth_name"":""\" & _

"uc11c\uc6b8"",""building_name"":""""},""address_name"":""\uc11c\uc6b8 \uac15\ub3d9\uad6c \uc554\uc0ac1\uac00\u" & _

"ae38 37"",""address"":{""b_code"":""1174010700"",""region_3depth_h_name"":""\uc554\uc0ac1\ub3d9"",""main_addre" & _

"ss_no"":""465"",""h_code"":""1174057000"",""region_2depth_name"":""\uac15\ub3d9\uad6c"",""main_adderss_no"":""4" & _

"65"",""sub_address_no"":""9"",""region_3depth_name"":""\uc554\uc0ac\ub3d9"",""address_name"":""\uc11c\uc6b8 \uac1" & _

"5\ub3d9\uad6c \uc554\uc0ac\ub3d9 465-9"",""y"":""37.55307124332294"",""x"":""127.13071105003783"",""mountain_" & _

"yn"":""N"",""zip_code"":""134857"",""region_1depth_name"":""\uc11c\uc6b8"",""sub_adderss_no"":""9""},""y"":""37.5" & _

"5308926323607"",""x"":""127.13071108150956"",""address_type"":""ROAD_ADDR""}]}")

MsgBox T



댓글목록 0

등록된 댓글이 없습니다.