A VBScript equivalent of PHP’s mb_convert_kana
Function mb_convert_kana( str , option_name )
Dim outstr
Dim J
Dim tmp
Dim bobj
If Len( str ) = 0 Then Exit Function
Set bobj = Server.CreateObject("basp21")
If Len( option_name ) = 0 Then
option_name = "K"
End If
outstr = str
For J = 1 To Len( option_name )
tmp = mid(option_name,J,1)
If tmp = "r" Then
'全角文字 (2 バイト) を半角文字 (1 バイト) に変換
outstr = bobj.StrConv(outstr,8)
ElseIf tmp = "R" Then
'半角文字 (1 バイト) を全角文字 (2 バイト) に変換
outstr = bobj.StrConv(outstr,4)
ElseIf tmp = "c" Then
'カタカナをひらがなに変換
outstr = bobj.StrConv(outstr,32)
ElseIf tmp = "C" Then
'ひらがなをカタカナに変換
outstr = bobj.StrConv(outstr,16)
ElseIf tmp = "K" or tmp = "V" THen
'文字列の中の半角カナを全角カナに変換します。濁音にも対応。
outstr = bobj.HAN2ZEN(outstr)
End If
Next
mb_convert_kana = outstr
End Function
Please also note that php.vbs offers community built functions and goes by the McDonald’s Theory. We’ll put online functions that are far from perfect, in the hopes to spark better contributions. Do you have one? Then please just: