Kanaria.Net 0.1.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Kanaria.Net --version 0.1.2
NuGet\Install-Package Kanaria.Net -Version 0.1.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Kanaria.Net" Version="0.1.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Kanaria.Net --version 0.1.2
#r "nuget: Kanaria.Net, 0.1.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Kanaria.Net as a Cake Addin
#addin nuget:?package=Kanaria.Net&version=0.1.2

// Install Kanaria.Net as a Cake Tool
#tool nuget:?package=Kanaria.Net&version=0.1.2

Kanaria

このライブラリは、ひらがな・カタカナ、半角・全角の相互変換や判別を始めとした機能を提供します。

Description

変換処理は次のものをご用意しています。

  • 変換処理
    • ひらがな<->カタカナの変換
    • 半角<->全角の変換(ガ<->ガのように、濁音記号の結合も行います)
    • アルファベットの大文字<->小文字変換

判定処理は次のものをご用意しています。<br> ひがらなを除き、それぞれ半角のみ、全角のみ、半角・全角区別なしの物があります。

  • 判定処理
    • ひらがな
    • カタカナ
    • 数字か
    • アルファベット
    • 記号

Demo / Usage

UCSStrに文字列を読み込ませ、変換先の設定を行い(この例だとカタカナに変換後、さらに半角に変換)、<br> Stringとして吐き出しているサンプルです。

let source = "吾輩は😺猫である😺";
let expect = "吾輩ハ😺猫デアル😺";

assert_eq!(expect.to_string(), UCSStr::from_str(source).katakana().narrow().to_string());

また、上記のようにメソッドチェーンによる連続した変換設定はできませんが、<br> 次のような形でも変換できます。<br>

use kanaria::converter::{Converter, ConverterFactory};
let target = vec!['あ', 'い', 'う', 'え', 'お'];
let mut result = Vec::<char>::with_capacity(target.len());
unsafe {
    // ほかにも、UCSStrと同じようにVec<T>やStringに出力する機能もあります
    let len = ConverterFactory::from_slice(target.as_slice())
        .katakana()
        .write_to_ptr(result.as_mut_ptr());
    result.set_len(len);
};
assert_eq!(result, vec!['ア', 'イ', 'ウ', 'エ', 'オ']);

この例は、半角文字を全角文字に変換しています。<br> この形式での変換は生ポインタ(*mut u16など)への書き込みを行うことができます。<br> 連続での変換はせず、なおかつ速度を求める場合はこちらのほうが便利です。<br> <br> ちなみに、他言語向けのラッパーライブラリも別途ご用意しています。<br> 以下はC#の例です(VB.NETからも同じ要領で使用できるはずです)。

var katakana = "吾輩ハ😺猫デアル😺";
var hiragana = "吾輩は😺猫である😺";
Assert.AreEqual(katakana, UcsString.From(hiragana).Katakana().ToString());
Assert.AreEqual(hiragana, UcsString.From(katakana).Hiragana().ToString());

Installation

※準備中

API

次のページをご参照ください(これはRust向けのものです)。<br> https://docs.rs/kanaria/0.1.1/kanaria/ <br> <br> RustDocのようにサンプルを交えての記載まではできていませんが、<br> 各言語のラッパー関数にも同様の関数コメントをご用意しています。<br>

Licence

MIT

Product Compatible and additional computed target framework versions.
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.2.0 755 2/23/2020
0.1.2 553 3/24/2019
0.1.1 518 3/24/2019
0.1.0 518 3/24/2019

Files needed at build time were accidentally packaged and removed.