JavaScript 剥离元音 [英] JavaScript Strip Vowels

查看:14
本文介绍了JavaScript 剥离元音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试去除字符串中的元音.我知道我应该使用 str.replace,但我对如何将其放入跨度感到困惑.

I am trying to strip vowels in a string. I know I should be using str.replace but I am baffled on how to get it into a span.

这更多的是我想做的事情:

This is more of less what i am looking to do:

编写一个 JavaScript 函数,它接受字符串 s 并返回与 s 等价的字符串,但删除了所有 ASCII 元音.例如:(Hello World") 返回:"Hll wrld"

Write a JavaScript function that takes in a string s and returns the string which is equivalent to s but with all ASCII vowels removed. EX: ("Hello World") returns: "Hll wrld"

请帮忙!

推荐答案

.replace(/[aeiou]/ig,'') 就是你所需要的.

这篇关于JavaScript 剥离元音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆