in ,

🧑🏻‍💻 TechAcademy | Active engineers explain how to use Ruby's NKF module [For beginners]

An active engineer explains how to use Ruby's NKF module [for beginners]

I will explain how to use the NKF module of Ruby.

 
If you're not familiar with Ruby in the first place, you can read the article that explains what Ruby is for a deeper understanding.

This article is based on the contents of the Ruby course of TechAcademy's online boot camp.

 

 

What is an NKF module?

The NKF module is a standard Ruby library for manipulating character strings so that you can easily convert hiragana to katakana and full-width to half-width.

 

How to use the NKF module

First, load the NKF module with require'nkf'.

Then write NKF.nkf (optional, string).

The options are “-h1” for katakana, “-h2” for hiragana…

→See more in Tech Tech Magazine