関数使用例(.NET 版)

Yubin7 Toolkit は 2017 年 10 月 30 日 をもって販売を終了いたしました。

関数名をクリックするとコード例を表示します。

AdvZipDic.vb/AdvZipDic.cs が提供する関数一覧

GetZipAddress 郵便番号を元に郵便番号辞書から該当する住所文字列を取得します。
(Visual Basic .NET)

Imports System.Collections.Generic

Partial Class Default
    Inherits System.Web.UI.Page

    Private advzip As AdvZipDic

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        ' AdvZipDic クラスのインスタンスを生成 
        advzip = New AdvZipDic()
        ' 辞書パス設定 
        advzip.DicFileName = "C:\Windows\System32\AdvZip.DIC"

        ' 郵便番号を元に住所データを取得
        Dim zipCode As String = "918-8239"
        Dim result As List(Of AdvZipDic.ZipAddress) = advzip.GetZipAddress(zipCode)

        ' 取得データを格納 
        Dim address As AdvZipDic.ZipAddress
        address = result(0)

        ' 結果を表示 
        Response.Write("7桁郵便場号 : " + address.ZipCode + "<br>")
        Response.Write("市町村コード : " + address.CityCode + "<br>")
        Response.Write("都道府県 : " + address.Pref + "<br>")
        Response.Write("市名1 : " + address.City1 + "<br>")
        Response.Write("市名2 : " + address.City2 + "<br>")
        Response.Write("町域名 : " + address.Town)

        advzip.Dispose()

    End Sub
End Class


(Visual C#)

using System;
using System.Collections.Generic;
using AdvanceSoftware.Yubin7.AdvZipDic;

public partial class Default : System.Web.UI.Page
{
    private AdvZipDic advzip;
    
    protected void Page_Load(object sender, EventArgs e)
    {
        // AdvZipDic クラスのインスタンスを生成
        advzip = new AdvZipDic();
        // 辞書パス設定
        advzip.DicFileName = @"C:\Windows\System32\AdvZip.DIC";

        // 郵便番号を元に住所データを取得
        String zipCode = "918-8239";
        List<AdvZipDic.ZipAddress> result = advzip.GetZipAddress(zipCode);

        // 取得データを格納
        AdvZipDic.ZipAddress address;
        address = result[0];
        
        // 結果を表示
        Response.Write("7桁郵便場号 : " + address.ZipCode + "<br>");
        Response.Write("市町村コード : " + address.CityCode + "<br>");
        Response.Write("都道府県 : " + address.Pref + "<br>");
        Response.Write("市名1 : " + address.City1 + "<br>");
        Response.Write("市名2 : " + address.City2 + "<br>");
        Response.Write("町域名 : " + address.Town);

        advzip.Dispose();
    }
}
Yubin7 住所文字列を元に郵便番号辞書から該当する郵便番号を取得します。
(Visual Basic .NET)

Partial Class Default
    Inherits System.Web.UI.Page

    Private advzip As AdvZipDic

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        ' AdvZipDic クラスのインスタンスを生成 
        advzip = New AdvZipDic()
        ' 辞書パス設定 
        advzip.DicFileName = "C:\Windows\System32\AdvZip.DIC"

        ' 住所データを元に郵便番号を取得  
        Dim strAddress As String = "福井県福井市成和1丁目2816番地"
        Dim result As AdvZipDic.ZipAddress = advzip.Yubin7(strAddress)

        ' 結果を表示 
        Response.Write("ステータス(取得有無) : " + result.Status + "<br>")
        Response.Write("7桁郵便場号 : " + result.ZipCode + "<br>")
        Response.Write("市町村コード : " + result.CityCode + "<br>")
        Response.Write("都道府県 : " + result.Pref + "<br>")
        Response.Write("市名1 : " + result.City1 + "<br>")
        Response.Write("市名2 : " + result.City2 + "<br>")
        Response.Write("町域名 : " + result.Town + "<br>")
        Response.Write("町域以降 : " + result.TownExt + "<br>")

        advzip.Dispose()

    End Sub
End Class


(Visual C#)

using System;
using AdvanceSoftware.Yubin7.AdvZipDic;

public partial class Default : System.Web.UI.Page
{
    private AdvZipDic advzip;
    
    protected void Page_Load(object sender, EventArgs e)
    {
        // AdvZipDic クラスのインスタンスを生成
        advzip = new AdvZipDic();
        // 辞書パス設定
        advzip.DicFileName = @"C:\Windows\System32\AdvZip.DIC";

        // 住所データを元に郵便番号を取得 
        String strAddress = "福井県福井市成和1丁目2816番地";
        AdvZipDic.ZipAddress result = advzip.Yubin7(strAddress);
        
        // 結果を表示
        Response.Write("ステータス(取得有無) : " + result.Status + "<br>");
        Response.Write("7桁郵便場号 : " + result.ZipCode + "<br>");
        Response.Write("市町村コード : " + result.CityCode + "<br>");
        Response.Write("都道府県 : " + result.Pref + "<br>");
        Response.Write("市名1 : " + result.City1 + "<br>");
        Response.Write("市名2 : " + result.City2 + "<br>");
        Response.Write("町域名 : " + result.Town + "<br>");
        Response.Write("町域以降 : " + result.TownExt + "<br>");

        advzip.Dispose();
    }
}
GetDicDownloadURL 製品シリアルNo と指定した郵便番号辞書のバージョンを元に、辞書ダウンロード用 URL を取得します。
取得された URL にアクセスすることで最新の郵便番号辞書をダウンロードすることが可能です。
(Visual Basic .NET)

Partial Class Default
    Inherits System.Web.UI.Page

    Private advzip As AdvZipDic

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        ' AdvZipDic クラスのインスタンスを生成 
        advzip = New AdvZipDic()
        ' 辞書パス設定 
        advzip.DicFileName = "C:\Windows\System32\AdvZip.DIC"

        Dim serial As String = "12345678"        ' シリアルNo
        Dim dicVersion As String = "161.0.0.01"  ' 辞書バージョン
        ' GetDicVersion 関数との併用例
        ' 郵便番号辞書(AdvZip.Dic)ファイルバージョン取得
        ' Dim type As AdvZipDic.VersionType = AdvZipDic.VersionType.DicVersion
        ' Dim dicVersion As String = advzip.GetDicVersion(type)

        ' 郵便番号辞書ダウンロード専用 URL の取得
        Dim url As String = advzip.GetDicDownloadURL(serial, dicVersion)

        ' 結果を表示
        Response.Write("辞書ダウンロード専用 URL : " + url)

        advzip.Dispose()

    End Sub
End Class


(Visual C#)

using System;
using AdvanceSoftware.Yubin7.AdvZipDic;

public partial class Default : System.Web.UI.Page
{
    private AdvZipDic advzip;

    protected void Page_Load(object sender, EventArgs e)
    {
        // AdvZipDic クラスのインスタンスを生成 
        advzip = new AdvZipDic();
        // 辞書パス設定 
        advzip.DicFileName = @"C:\Windows\System32\AdvZip.DIC";

        String serial = "12345678";        // シリアルNo
        String dicVersion = "161.0.0.01 ";  // 辞書バージョン
        /* GetDicVersion 関数との併用例
         * 郵便番号辞書(AdvZip.Dic)ファイルバージョン取得
         * AdvZipDic.VersionType type = AdvZipDic.VersionType.DicVersion;
         * String dicVersion = advzip.GetDicVersion(type);
         */

        // 郵便番号辞書ダウンロード専用 URL の取得  
        String url = advzip.GetDicDownloadURL(serial, dicVersion);

        // 結果を表示 
        Response.Write("辞書ダウンロード専用 URL : " + url);

        advzip.Dispose();
    }
}
GetDicVersion 指定した郵便番号辞書のバージョン情報を取得します。
(Visual Basic .NET)

Partial Class Default
    Inherits System.Web.UI.Page

    Private advzip As AdvZipDic

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        ' AdvZipDic クラスのインスタンスを生成 
        advzip = New AdvZipDic()
        ' 辞書パス設定
        advzip.DicFileName = "C:\Windows\System32\AdvZip.DIC"

        ' 郵便番号辞書(AdvZip.Dic)ファイルバージョン取得
        ' 辞書バージョン
        Dim dicVersion As String = advzip.GetDicVersion(AdvZipDic.VersionType.DicVersion)
        ' データ公開日
        Dim releaseData As String = advzip.GetDicVersion(AdvZipDic.VersionType.ReleaseDate)
        ' データ保障日
        Dim assureDate As String = advzip.GetDicVersion(AdvZipDic.VersionType.AssureDate)
        ' ファイル生成日
        Dim createDate As String = advzip.GetDicVersion(AdvZipDic.VersionType.CreateDate)
        ' AdvZipDicクラスバージョン
        Dim advZipDicClass As String = advzip.GetDicVersion(AdvZipDic.VersionType.AdvZipDicClass)

        ' 結果を表示
        Response.Write("辞書バージョン : " + dicVersion + "<br>")
        Response.Write("データ公開日 : " + releaseData + "<br>")
        Response.Write("データ保障日 : " + assureDate + "<br>")
        Response.Write("ファイル生成日 : " + createDate + "<br>")
        Response.Write("AdvZipDicクラスバージョン : " + advZipDicClass)

        advzip.Dispose()

    End Sub
End Class


(Visual C#)

using System;
using AdvanceSoftware.Yubin7.AdvZipDic;

public partial class Default : System.Web.UI.Page
{
    private AdvZipDic advzip;
    
    protected void Page_Load(object sender, EventArgs e)
    {
        // AdvZipDic クラスのインスタンスを生成
        advzip = new AdvZipDic();
        // 辞書パス設定
        advzip.DicFileName = @"C:\Windows\System32\AdvZip.DIC";

        // 郵便番号辞書(AdvZip.Dic)ファイルバージョン取得
        String dicVersion = advzip.GetDicVersion(AdvZipDic.VersionType.DicVersion);         // 辞書バージョン
        String releaseData = advzip.GetDicVersion(AdvZipDic.VersionType.ReleaseDate);       // データ公開日
        String assureDate = advzip.GetDicVersion(AdvZipDic.VersionType.AssureDate);         // データ保障日
        String createDate = advzip.GetDicVersion(AdvZipDic.VersionType.CreateDate);         // ファイル生成日
        String advZipDicClass = advzip.GetDicVersion(AdvZipDic.VersionType.AdvZipDicClass); // AdvZipDicクラスバージョン
        
        // 結果を表示
        Response.Write("辞書バージョン : " + dicVersion + "<br>");
        Response.Write("データ公開日 : " + releaseData + "<br>");
        Response.Write("データ保障日 : " + assureDate + "<br>");
        Response.Write("ファイル生成日 : " + createDate + "<br>");
        Response.Write("AdvZipDicクラスバージョン : " + advZipDicClass);

        advzip.Dispose();
    }
}

提供関数の実際の動作を確認することが可能な動作デモページを公開しております。

「Yubin7 Ver2.6」付属の .NET Framework クラスライブラリでは、より多くの変換機能をサポートしています。