transliteration icon indicating copy to clipboard operation
transliteration copied to clipboard

Mixing of numbers and Chinese and English

Open szx741 opened this issue 2 years ago • 3 comments

想要数字前后也要有分隔符 slugify('2022年中文01英文nihao02') 现在的slugify是这样子的 2022nian-zhong-wen-01ying-wen-nihao02 但我想要 2022-nian-zhong-wen-01-ying-wen-nihao-02 不知道有没有这样子的功能

szx741 avatar Aug 05 '22 14:08 szx741

Well, it supposed to work that way, I'll do some investigation. Meanwhile you can implement it with a workaround like:

slugify('2022年中文01英文nihao02'.replace(/(\d+)/g, ' $1 ')).replace(/^-|-$/g, '')

yf-hk avatar Aug 06 '22 02:08 yf-hk

你好,我又发现有一点问题,中文在前,英文在后,中间会有横杠,如果中文在后,英文在前,就没有横杠连接了。 比如 slugify('你好world') //ni-hao-world slugify('hello世界') //helloshi-jie

szx741 avatar Sep 03 '22 13:09 szx741