はじめに
VBScriptで、PHPのhtmlspecialcharsメソッド(特殊文字を HTML エンティティに変換する)を実装してみました。
Function htmlspecialchars(Byref string, Byref quote_style) Dim tmp tmp = string tmp = Replace(tmp, "&", "&") tmp = Replace(tmp, "<", "<") tmp = Replace(tmp, ">", ">") If quote_style = "" OR quote_style = "ENT_COMPAT" Then tmp = Replace(tmp, """", """) ElseIf quote_style = "ENT_QUOTES" Then tmp = Replace(tmp, """", """) tmp = Replace(tmp, "'", "'") ElseIf quote_style = "ENT_NOQUOTES" Then ' NOP End If htmlspecialchars = tmp End Function
charset、double_encodeパラメタについては、実装していません。
参考サイト
最速攻略 VBScriptサンプル大全集
posted with amazlet at 10.08.18
結城 圭介
技術評論社
売り上げランキング: 17109
技術評論社
売り上げランキング: 17109
おすすめ度の平均:
最速攻略に偽りなし。分かりやすいと思いますよ
ステップアップ
ユーズドで買う人は要注意
VBScriptが使いこなせる本