Skip to content

Commit d2a1b7f

Browse files
author
Kohei Asai
authored
1119. Remove Vowels from a String (axross#141)
1 parent d774f91 commit d2a1b7f

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Diff for: solutions/remove_vowels_from_a_string.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// 1119. Remove Vowels from a String
2+
// https://leetcode.com/problems/remove-vowels-from-a-string/
3+
export default function removeVowels2(S: string): string {
4+
return S.replace(/[aeiou]+/g, "");
5+
}

Diff for: solutions/remove_vowels_from_a_string_test.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { test } from "https://deno.land/std/testing/mod.ts";
2+
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
3+
import removeVowels from "./remove_vowels_from_a_string.ts";
4+
5+
test("1119. Remove Vowels from a String", () => {
6+
assertEquals(
7+
removeVowels("leetcodeisacommunityforcoders"),
8+
"ltcdscmmntyfrcdrs"
9+
);
10+
assertEquals(removeVowels("aeiou"), "");
11+
});

0 commit comments

Comments
 (0)