Skip to content

Latest commit

ย 

History

History
93 lines (70 loc) ยท 3.03 KB

README.md

File metadata and controls

93 lines (70 loc) ยท 3.03 KB

Remove Emoji ( 2021 )

Gem Version Build Status Code Climate

ๆญค็‚บ้‡ๅฐใ€Œ็งป้™คใ€Unicode Emoji ๅœ–็คบ ๆ‰€้–‹็™ผ็š„ๅฐˆๅฑฌๅฅ—ไปถ๏ผŒ ๆ‚จๅฏไปฅ้€้Ž่ฉฒๅฅ—ไปถ็งป้™คไปคไบบๅ›ฐๆ“พ็š„ Emoji ็ฌฆ่™Ÿใ€‚ ( It can remove any of the emoji supported by that package. )

emoji

Installation / ๅฎ‰่ฃๆ–นๅผ

via Rubygems

gem install remove_emoji

In your Gemfile:

gem 'remove_emoji', '~> 3.0.0'

Usage / ไฝฟ็”จๆ–นๅผ

ไฝฟ็”จๆ–นๅผๅพˆ็ฐกๅ–ฎ๏ผŒๅƒ…้œ€่ฆๅ‘ผๅซ RemoveEmoji::Sanitize.call ้žๅ…ฅไฝ ่ฆ้Žๆฟพ็š„ๅญ—ไธฒๅณๅฏ้Žๆฟพใ€‚

require 'remove_emoji'

original_string = "๐Ÿ˜Š๐Ÿ˜๐Ÿ˜Œ๐Ÿค•๐Ÿ‘ฟ๐Ÿ‘น๐Ÿ‘ง๐Ÿ‘ง๐Ÿป๐Ÿ‘ง๐Ÿผ๐Ÿ‘ง๐Ÿฝ๐Ÿคœ๐Ÿผ๐Ÿ‘๐Ÿฝ๐Ÿ‘Œโ˜๐Ÿผ๐Ÿฅ๐Ÿฅฆ๐ŸŒถ๐ŸŒฝ๐ŸŽ"

puts RemoveEmoji::Sanitize.call(original_string)
require 'remove_emoji'

# ==========
#   Input
# ==========
original_string = <<-STRING
abcdefghijklmnopqrstuvwxyz....0123456789
ไธๆฅต๏ผŒ็‰ฉ็‰‡้กžๆ›ธ่ปŠ่ฃก๏ผๅไปŠๆžœๅŠๆŽฅๅœ‹ๅ…ˆ้›„
ใƒ‹ใƒƒใƒใƒณใ€ใ€Œใƒ‹ใƒ›ใƒณใ€ไธกๆ–นไฝฟ็”จใ•ใ‚Œใ‚‹ไธญ
๐Ÿš—๐Ÿš“๐Ÿšจ๐Ÿšฒ๐Ÿšก๐Ÿš…๐Ÿ›ถ๐Ÿ’บ๐Ÿš๐Ÿฆ๐Ÿ•‹๐Ÿฆ๐Ÿ“ฑโŒš๏ธ๐Ÿ–ฒ๐Ÿ•ฏ๐Ÿ”ฎ๐ŸŽŽ๐ŸŽ๐Ÿ’Œ๐Ÿ“ฆ
๐Ÿ“Œโ˜ฎ๏ธ๐Ÿ’Ÿ๐Ÿ”ฏโ˜ช๏ธใŠ—๏ธ๐Ÿˆต๐Ÿ†š๐Ÿ’ฏโ•๐Ÿ”ž๐Ÿšท๐Ÿ”ฐโ‰๏ธโš ๏ธ๐Ÿ’ค๐ŸŒ๐ŸŒ€โ–ถ๏ธ๐Ÿ” ๐Ÿ”ฃโ†”๏ธโ†ฉ๏ธ๐Ÿ‘โ€๐Ÿ—จ
โ—ฝ๏ธ๐Ÿ”ฒ๐Ÿ‡ต๐Ÿ‡ฆ๐Ÿณ๏ธ๐Ÿณ๏ธโ€๐ŸŒˆ๐Ÿ‡น๐Ÿ‡ฒ๐Ÿ‡น๐Ÿ‡ท๐Ÿค›๐Ÿคœ๐Ÿผ๐Ÿ‘๐Ÿฝ๐Ÿ‘Œโ˜๐Ÿผ๐Ÿฅ๐Ÿฅฆ๐ŸŒถ๐ŸŒฝ๐ŸŽ
๐Ÿฒ๐Ÿ”๐Ÿฅž๐Ÿ๐Ÿ”๐Ÿ—๐ŸŒฎ๐Ÿฏ๐Ÿฅ ๐Ÿฅข๐Ÿด๐Ÿฅ„๐Ÿฅ‚โ˜•๏ธ๐Ÿ˜€๐Ÿ˜ƒ๐Ÿ˜„๐Ÿคฃ๐Ÿ˜‚๐Ÿ˜…๐Ÿ˜†โ˜บ๏ธ๐Ÿ˜Š๐Ÿ˜๐Ÿ˜Œ
๐Ÿ˜˜๐Ÿ˜—๐Ÿ˜™๐Ÿ˜š๐Ÿ˜œ๐Ÿ˜๐Ÿ˜›๐Ÿ˜‹๐Ÿคจ๐Ÿง๐Ÿค“๐Ÿ˜’๐Ÿ˜๐Ÿคฉ๐Ÿคฉ๐Ÿ˜Ž๐Ÿ˜ž๐Ÿ˜”๐Ÿ˜–๐Ÿ˜ข๐Ÿ˜ฃโ˜น๏ธ๐Ÿ˜ฉ๐Ÿ™๐Ÿคฏ
๐Ÿ˜ฐ๐Ÿ˜“๐Ÿ˜ฆ๐Ÿ˜ฒ๐Ÿค’๐Ÿค•๐Ÿ‘ฟ๐Ÿ‘น๐Ÿ‘ฝโœŠ๐Ÿผ
ใซใฏๆ–‡์ค‘๊ตญ, ์ผ๋ณธ, ๋ฒ ํŠธ๋‚จ ๋“ฑ ํ•œ์ž ๋ฌธํ™”๊ถŒ์— ์†ํ•˜๋Š” ์•„์‹œ์•„ ์—ฌ๋Ÿฌ ๊ตญ๊ฐ€์—์„œ๋Š” 
ํ•œ๊ตญ์–ด็š„ๅทฎๅผ‚ๅค–๏ผŒ้€šๅธธ่ฎคไธบ่ฟ˜ๅญ˜ๅœจ่ฏๆฑ‡ไธŠ็š„ๅทฎๅผ‚ใ€‚ไพ‹ๅฆ‚็นไฝ“ไธญๆ–‡้‡Œๅคš็”จ็š„โ€œๅŽŸ
ู„ู…ู†ุทู‚ุฉ ุงู„ุดุฑู‚ ุงู„ุฃูˆุณุท ู‡ูŠู„ูŠ: ุงู„ุชุญุฑูƒ ุถุฏ ุฅูŠุฑุงู† ุณูŠุจุฏุฃ ู…ู† ู…ุฌู„ุณ ุงู„ุฃู…ู†
STRING

# ==========
#   Output
# ==========
puts RemoveEmoji::Sanitize.call(original_string)

# Result:
# abcdefghijklmnopqrstuvwxyz....0123456789
# ไธๆฅต๏ผŒ็‰ฉ็‰‡้กžๆ›ธ่ปŠ่ฃก๏ผๅไปŠๆžœๅŠๆŽฅๅœ‹ๅ…ˆ้›„
# ใƒ‹ใƒƒใƒใƒณใ€ใ€Œใƒ‹ใƒ›ใƒณใ€ไธกๆ–นไฝฟ็”จใ•ใ‚Œใ‚‹ไธญ
# 
# 
# 
# 
# 
# 
# ใซใฏๆ–‡์ค‘๊ตญ, ์ผ๋ณธ, ๋ฒ ํŠธ๋‚จ ๋“ฑ ํ•œ์ž ๋ฌธํ™”๊ถŒ์— ์†ํ•˜๋Š” ์•„์‹œ์•„ ์—ฌ๋Ÿฌ ๊ตญ๊ฐ€์—์„œ๋Š”
# ํ•œ๊ตญ์–ด็š„ๅทฎๅผ‚ๅค–๏ผŒ้€šๅธธ่ฎคไธบ่ฟ˜ๅญ˜ๅœจ่ฏๆฑ‡ไธŠ็š„ๅทฎๅผ‚ใ€‚ไพ‹ๅฆ‚็นไฝ“ไธญๆ–‡้‡Œๅคš็”จ็š„โ€œๅŽŸ
# ู„ู…ู†ุทู‚ุฉ ุงู„ุดุฑู‚ ุงู„ุฃูˆุณุท ู‡ูŠู„ูŠ: ุงู„ุชุญุฑูƒ ุถุฏ ุฅูŠุฑุงู† ุณูŠุจุฏุฃ ู…ู† ู…ุฌู„ุณ ุงู„ุฃู…ู†

Demo ( Before / After )

emoji_effect

LICENSE

ๆœฌๅฐˆๆกˆๅŽŸๅง‹็ขผๆŽก MIT LICENSE ๆŽˆๆฌŠ ( ่ฉณ่ฆ‹ LICENSE ๆช”ๆกˆ )