LoginSignup
0
0

More than 3 years have passed since last update.

vbsの作法 その31

Posted at

概要

vbsの作法調べてみた。
base64encodeしてみた。

サンプルコード


Function base64enc(PlainText)
    Dim st
    Dim dom
    Dim tmp
    Dim bin
    Set st = CreateObject("ADODB.Stream")
    st.Type = adTypeText
    st.Charset = "Shift-JIS"
    st.Open
    st.WriteText PlainText
    st.Position = 0
    st.Type = adTypeBinary
    bin = st.Read
    st.Close
    Set dom = CreateObject("Microsoft.XMLDOM")
    Set tmp = dom.CreateElement("tmp")
    tmp.DataType = "bin.base64"
    tmp.NodeTypedValue = bin
    base64enc = tmp.Text
End Function

Const adTypeBinary = 1
Const adTypeText = 2 
Dim str0, str1
str0 = "あ"
str1 = base64enc(str0)
MsgBox str1

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0