Submit Search
Upload
和暦&漢数字gem
•
0 likes
•
251 views
T
Tatsuki Sugiura
Follow
平成も終わるので和暦gemを紹介+漢数字gemの相談
Read less
Read more
Engineering
Report
Share
Report
Share
1 of 23
Download now
Download to read offline
Recommended
和暦&漢数字gem (ProLabo渋谷もくもく会 #4)
和暦&漢数字gem (ProLabo渋谷もくもく会 #4)
Tatsuki Sugiura
Frontend負債返済の野望 @ Repro
Frontend負債返済の野望 @ Repro
Tatsuki Sugiura
FLOSSとフリーカルチャーの流れ
FLOSSとフリーカルチャーの流れ
Tatsuki Sugiura
Git overview (v 0.96)
Git overview (v 0.96)
Tatsuki Sugiura
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
Recommended
和暦&漢数字gem (ProLabo渋谷もくもく会 #4)
和暦&漢数字gem (ProLabo渋谷もくもく会 #4)
Tatsuki Sugiura
Frontend負債返済の野望 @ Repro
Frontend負債返済の野望 @ Repro
Tatsuki Sugiura
FLOSSとフリーカルチャーの流れ
FLOSSとフリーカルチャーの流れ
Tatsuki Sugiura
Git overview (v 0.96)
Git overview (v 0.96)
Tatsuki Sugiura
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
ChatGPT webinar slides
ChatGPT webinar slides
Alireza Esmikhani
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
Project for Public Spaces & National Center for Biking and Walking
More Related Content
Featured
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
ChatGPT webinar slides
ChatGPT webinar slides
Alireza Esmikhani
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
Project for Public Spaces & National Center for Biking and Walking
Featured
(20)
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
Skeleton Culture Code
Skeleton Culture Code
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
How to have difficult conversations
How to have difficult conversations
Introduction to Data Science
Introduction to Data Science
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
The six step guide to practical project management
The six step guide to practical project management
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
ChatGPT webinar slides
ChatGPT webinar slides
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
和暦&漢数字gem
1.
和暦&漢数字gem - 平成も終わるので和暦gemを紹介+
Powered by Rabbit 2.2.1 和暦&漢数字gem 平成も終わるので和暦gemを紹介+ 杉浦達樹
2.
和暦&漢数字gem - 平成も終わるので和暦gemを紹介+
Powered by Rabbit 2.2.1 今から話す内容 3年くらい前に作った和暦の gemの紹介 ✓ 漢数字処理を分離して新規gem にします ✓ 事例とかあったら是非教えてく ださい ✓
3.
和暦&漢数字gem - 平成も終わるので和暦gemを紹介+
Powered by Rabbit 2.2.1 - wareki (和暦) gem http://github.com/sugi/wareki
4.
和暦&漢数字gem - 平成も終わるので和暦gemを紹介+
Powered by Rabbit 2.2.1 和暦に gem 要るの? 大抵個別案件で適当に書けるが✓ でも微妙に面倒 全角や漢数字の面倒見たくない✓ 明治6年より前は困る✓ ✓ 別に難しくはないけど面倒 → 決定版を作ってもう悩むのをや めよう! ✓ ✓
5.
和暦&漢数字gem - 平成も終わるので和暦gemを紹介+
Powered by Rabbit 2.2.1 和暦 gem の売り 日本語日付パース出来ます!✓ 日付を日本語で色々フォーマッ トできます ✓ 日本の旧暦扱えます✓ 大化から全元号いけます✓
6.
和暦&漢数字gem - 平成も終わるので和暦gemを紹介+
Powered by Rabbit 2.2.1 日本語パース 半角全角漢数字スタイル混在✓ 一文字年号、旧字元号✓ Date.parse("平成27年1二月8日") # => 2015-12-8 Date.parse("㍼一〇年5月二十八日") # => 1935-05-28 Date.parse("西暦10年5月3日") # => 10-5-3 Date.parse("紀元前203年12月31日") # => -203-12-31
7.
和暦&漢数字gem - 平成も終わるので和暦gemを紹介+
Powered by Rabbit 2.2.1 日本語パース 旧暦✓ 閏月✓ Date.parse("明治5年12月2日") # => 1872-12-31 Date.parse("安政7年3月17日") # => 1860-4-7 Date.parse("元仁1年うるう7月1日") # => 1224-8-17
8.
和暦&漢数字gem - 平成も終わるので和暦gemを紹介+
Powered by Rabbit 2.2.1 日本語パース 元年、正月、元日、元旦✓ Date.parse("元仁二年 元日") # => 1225-2-9 Date.parse("平成元年元旦") # => 1989-1-1
9.
和暦&漢数字gem - 平成も終わるので和暦gemを紹介+
Powered by Rabbit 2.2.1 日本語パース 朔日、 晦日(その月の最終日)✓ Date.parse("元仁元年閏七月朔日") # => 1224-8-17 Date.parse("寿永三年 五月 晦日") # => 1184-7-9 Date.parse("平成12年十二月晦日") # => 2000-12-31 Date.parse("平成31年2月晦日") # => 2019-02-28
10.
和暦&漢数字gem - 平成も終わるので和暦gemを紹介+
Powered by Rabbit 2.2.1 日本語パース 月の別名✓ Date.parse("安政七年 弥生") # => 1860-03-22 Date.parse("平成30年神無月5日") # => 2018-10-05
11.
和暦&漢数字gem - 平成も終わるので和暦gemを紹介+
Powered by Rabbit 2.2.1 日本語パース 大字(だいじ)✓ Date.parse("㍻ 拾年 肆月 陸日") # => 1998-04-06 Date.parse("安政漆年參月廿日") # => 1860-4-10 Date.parse("皇紀貳阡皕卌年") # => 1580-01-17
12.
和暦&漢数字gem - 平成も終わるので和暦gemを紹介+
Powered by Rabbit 2.2.1 日本語へのフォーマット d = Date.today d.strftime("%JF") # => "平成三十一年四月十日" d.strftime("%Jf") # => "平成31年4月10日" stftime ラッパーでフォーマット 文字列追加 %JF: 漢字✓ %Jf: 半角✓ 他にもたくさん✓ ✓
13.
和暦&漢数字gem - 平成も終わるので和暦gemを紹介+
Powered by Rabbit 2.2.1 まとめ: 平成も終わるので この機会に内部は標準Dateオ ブジェクトに ✓ 古い文書を扱う人にはぜひ試し てもらいたい 歴史上の人物の年齢を計算したりす るのが楽です ✓ ✓ 以上和暦 gem の紹介✓
14.
和暦&漢数字gem - 平成も終わるので和暦gemを紹介+
Powered by Rabbit 2.2.1 - 漢数字gem 作ります http://github.com/sugi/ ya_kansuji
15.
和暦&漢数字gem - 平成も終わるので和暦gemを紹介+
Powered by Rabbit 2.2.1 漢数字gem要る? 和暦の漢数字処理を分離したい✓ これもまあ個別に書けるけど ちゃんとパースするのが微妙に面倒✓ 色々フォーマットあればまあ便利?✓ ✓ 別に難しくはないけど面倒 → ライブラリに任せたい✓ ✓
16.
和暦&漢数字gem - 平成も終わるので和暦gemを紹介+
Powered by Rabbit 2.2.1 漢数字 gem に必要な機能 漢数字や漢字混じり数字文字列 ⇔ 数値 単にこれだけだけど……✓ 網羅しようとすると意外に色々 網羅してあるだけでも意味がありそう✓ 事例あれば教えて下さい✓ ✓
17.
和暦&漢数字gem - 平成も終わるので和暦gemを紹介+
Powered by Rabbit 2.2.1 漢数字文字列 → 数値 漢数字 (千二百, 一二〇〇)✓ 全角数字 (1234)✓ 漢字数字混在 (1億30万) 数字コンマ混じり (3億5,000万)✓ ✓ 位取り (千〇二十八, 5万0030)✓ 大字 (千皕卅肆)✓
18.
和暦&漢数字gem - 平成も終わるので和暦gemを紹介+
Powered by Rabbit 2.2.1 数値 → 漢数字文字列 練習問題にあるパターン: 123456789 => "一億二千三百四十五万六千七百八十九" ✓ シンプルだけど、これ実際に使 うかな? ✓
19.
和暦&漢数字gem - 平成も終わるので和暦gemを紹介+
Powered by Rabbit 2.2.1 数値 → 漢数字 (実例) 『一橋社会科学』編集委員会: 六億五七八三万七六九一人a. 約八千万人 / 八百万人 / 八千人b. 一九四五年 / 二五〇〇枚c. 十三世紀 / 二十世紀 / 六十五万票d. ✓ (http://www.soc.hit-u.ac.jp/ journal/hyouki.pdf)
20.
和暦&漢数字gem - 平成も終わるので和暦gemを紹介+
Powered by Rabbit 2.2.1 数値 → 漢数字 (実例) 「公用文作成の要領」方式: 100億, 30万円 / 5,000 ✓ 行政司法協会方式: 1,200億 / 2億58万6,300円 ✓ 裁判判例縦書き方式: 一二万〇〇五六円 ✓ 最高裁判例横書き方式: 5万0539円 ✓
21.
和暦&漢数字gem - 平成も終わるので和暦gemを紹介+
Powered by Rabbit 2.2.1 選択式フォーマッタ to_kan(12340005) # => "千二百三十四万五" to_kan(12340005, :simple) # => "千二百三十四万五" to_kan(12340005, :gov) # => "1234万, 5" to_kan(12340005, :lawyer) # => "1,234万5" to_kan(12340005, :judic) # => "一二三四万〇〇〇五" to_kan(12340005, :judic_v) # => "1234万0005"
22.
和暦&漢数字gem - 平成も終わるので和暦gemを紹介+
Powered by Rabbit 2.2.1 ユーザ拡張フォーマッタ YaKansuji.register_formatter :hoge, -> (num, opts = {}) { if num == 0 ; "" elsif num == 1; "いち" elsif num == 2; "に" else; "たくさん" end } to_kan(2, :hoge) # => "に" to_kan(123, :hoge) # => "たくさん"
23.
和暦&漢数字gem - 平成も終わるので和暦gemを紹介+
Powered by Rabbit 2.2.1 以上 漢数字 gem 和暦で要る部分は外部化✓ 事例や情報あればお願いします✓
Download now