Skip to content

Instantly share code, notes, and snippets.

@ken-itakura
ken-itakura / strutils.py
Created May 25, 2017 07:29
python unicode str conversion functions
# -*- coding: utf-8 -*-
"""
Created on 2017/5/25
@author: itakura
"Unicode <-> str 変換関連"
"""
class strutils:
@ken-itakura
ken-itakura / MD5.vb
Created November 8, 2016 12:58
Excel, Access VBA Function to create MD5 for text
Public Function MD5Hex(textString As String) As String   
Dim enc   
Dim textBytes() As Byte   
Dim bytes   
Dim outstr As String       
Set enc = CreateObject("System.Security.Cryptography.MD5CryptoServiceProvider")   
textBytes = textString   
bytes = enc.ComputeHash_2((textBytes))   
@ken-itakura
ken-itakura / Csv2Map.scala
Created October 4, 2016 07:14
Read CSV and create Map
import scala.io.Source
// Read CSV create and create Map
object DictSource2SeedDict extends App {
val csvFile = Source.fromFile("file_path", "utf8")
val listDict = Map(csvFile.getLines.toList.map{l =>
val lc = l.split("\t")
(lc(0)->lc(1)) // assume first field is key and second field is value
@ken-itakura
ken-itakura / IsAllHiragana, IsAllKatakana
Created October 1, 2016 20:13
Excel function that checks whether a cell contains Hiragana only or Katakana only
Public Function IsAllHiragana(cell)
Set REG = CreateObject("VBScript.RegExp")
REG.Pattern = "^[ぁ-んー]+$" ' there are a couple of more hiragana in unicode, which are ignored
Set REGMatch = REG.Execute(cell)
If REGMatch.Count > 0 Then
IsAllHiragana = True
Else
IsAllHiragana = False
End If
End Function