Remove vowels from a string: Difference between revisions

Content added Content deleted
No edit summary
m (syntax highlighting fixup automation)
Line 9: Line 9:
{{trans|Python}}
{{trans|Python}}


<lang 11l>F exceptGlyphs(exclusions, s)
<syntaxhighlight lang="11l">F exceptGlyphs(exclusions, s)
R s.filter(c -> c !C @exclusions).join(‘’)
R s.filter(c -> c !C @exclusions).join(‘’)


Line 20: Line 20:
in one approach to a problem in learning another.’
in one approach to a problem in learning another.’


print(exceptGlyphs(‘eau’, txt))</lang>
print(exceptGlyphs(‘eau’, txt))</syntaxhighlight>


{{out}}
{{out}}
Line 35: Line 35:
=={{header|8080 Assembly}}==
=={{header|8080 Assembly}}==


<lang 8080asm> org 100h
<syntaxhighlight lang="8080asm"> org 100h
jmp demo
jmp demo
;;; Remove the vowels from the $-terminated string at [DE]
;;; Remove the vowels from the $-terminated string at [DE]
Line 65: Line 65:
mvi c,9 ; Print using CP/M
mvi c,9 ; Print using CP/M
jmp 5
jmp 5
string: db 'THE QUICK BROWN FOX jumps over the lazy dog$'</lang>
string: db 'THE QUICK BROWN FOX jumps over the lazy dog$'</syntaxhighlight>


{{out}}
{{out}}
Line 72: Line 72:


=={{header|Action!}}==
=={{header|Action!}}==
<lang Action!>BYTE FUNC IsVovel(CHAR c)
<syntaxhighlight lang="action!">BYTE FUNC IsVovel(CHAR c)
CHAR ARRAY vovels="AEIOUaeiou"
CHAR ARRAY vovels="AEIOUaeiou"
BYTE i
BYTE i
Line 110: Line 110:
Test("The Quick Brown Fox Jumped Over the Lazy Dog's Back")
Test("The Quick Brown Fox Jumped Over the Lazy Dog's Back")
Test("Action! is a programming language for Atari 8-bit computer.")
Test("Action! is a programming language for Atari 8-bit computer.")
RETURN</lang>
RETURN</syntaxhighlight>
{{out}}
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Remove_vowels_from_a_string.png Screenshot from Atari 8-bit computer]
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Remove_vowels_from_a_string.png Screenshot from Atari 8-bit computer]
Line 126: Line 126:


=={{header|Ada}}==
=={{header|Ada}}==
<lang Ada>with Ada.Text_IO; use Ada.Text_IO;
<syntaxhighlight lang="ada">with Ada.Text_IO; use Ada.Text_IO;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;


Line 156: Line 156:
Put_Line (NV2);
Put_Line (NV2);
end Main;
end Main;
</syntaxhighlight>
</lang>
{{output}}
{{output}}
<pre>
<pre>
Line 167: Line 167:


=={{header|ALGOL 68}}==
=={{header|ALGOL 68}}==
<lang algol68>BEGIN
<syntaxhighlight lang="algol68">BEGIN
# returns s with the vowels removed #
# returns s with the vowels removed #
OP DEVOWEL = ( STRING s )STRING:
OP DEVOWEL = ( STRING s )STRING:
Line 191: Line 191:
test devowel( "abcdefghijklmnoprstuvwxyz" );
test devowel( "abcdefghijklmnoprstuvwxyz" );
test devowel( "Algol 68 Programming Language" )
test devowel( "Algol 68 Programming Language" )
END</lang>
END</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 202: Line 202:


=={{header|APL}}==
=={{header|APL}}==
<lang APL>devowel ← ~∘'AaEeIiOoUu'</lang>
<syntaxhighlight lang="apl">devowel ← ~∘'AaEeIiOoUu'</syntaxhighlight>
{{out}}
{{out}}
<pre> devowel 'THE QUICK BROWN FOX jumps over the lazy dog'
<pre> devowel 'THE QUICK BROWN FOX jumps over the lazy dog'
Line 217: Line 217:
We can also improve productivity by using library functions whenever feasible.
We can also improve productivity by using library functions whenever feasible.


<lang applescript>------- REMOVE A DEFINED SUBSET OF GLYPHS FROM A TEXT ------
<syntaxhighlight lang="applescript">------- REMOVE A DEFINED SUBSET OF GLYPHS FROM A TEXT ------


-- exceptGlyphs :: String -> String -> Bool
-- exceptGlyphs :: String -> String -> Bool
Line 324: Line 324:
set my text item delimiters to dlm
set my text item delimiters to dlm
s
s
end unlines</lang>
end unlines</syntaxhighlight>
{{Out}}
{{Out}}
<pre>Rostt Cod is progrmming chrstomthy sit.
<pre>Rostt Cod is progrmming chrstomthy sit.
Line 337: Line 337:
As has been noted on the Discussion page, this is necessarily a parochial task which depends on the natural language involved being written with vowels and consonants and on what constitutes a vowel in its orthography. w and y are vowels in Welsh, but consonants in English, although y is often used as a vowel in English too, as it is in other languages. The code below demonstrates how AppleScript might remove the five English vowels and their diacritical forms from a Latinate text. AppleScript can be made to "ignore" diacriticals and case in string comparisons, but not to ignore ligatures or other variations which aren't strictly speaking diacriticals, such as ø. These would need to be included in the vowel list explicitly.
As has been noted on the Discussion page, this is necessarily a parochial task which depends on the natural language involved being written with vowels and consonants and on what constitutes a vowel in its orthography. w and y are vowels in Welsh, but consonants in English, although y is often used as a vowel in English too, as it is in other languages. The code below demonstrates how AppleScript might remove the five English vowels and their diacritical forms from a Latinate text. AppleScript can be made to "ignore" diacriticals and case in string comparisons, but not to ignore ligatures or other variations which aren't strictly speaking diacriticals, such as ø. These would need to be included in the vowel list explicitly.


<lang applescript>-- Bog-standard AppleScript global-search-and-replace handler.
<syntaxhighlight lang="applescript">-- Bog-standard AppleScript global-search-and-replace handler.
-- searchText can be either a single string or a list of strings to be replaced with replacementText.
-- searchText can be either a single string or a list of strings to be replaced with replacementText.
on replace(mainText, searchText, replacementText)
on replace(mainText, searchText, replacementText)
Line 363: Line 363:
set devowelledText to replace(txt, {"a", "e", "i", "o", "u"}, "")
set devowelledText to replace(txt, {"a", "e", "i", "o", "u"}, "")
end ignoring
end ignoring
return devowelledText</lang>
return devowelledText</syntaxhighlight>


{{output}}
{{output}}
<lang AppleScript>"Th qck brwn fx jmps vr th lzy dg
<syntaxhighlight lang="applescript">"Th qck brwn fx jmps vr th lzy dg
L'œvr d'n lv
L'œvr d'n lv
vn Dijk
vn Dijk
Line 373: Line 373:
Jř Blhlvk cndcts Mrtn
Jř Blhlvk cndcts Mrtn
P c pn tk brzczy w gszcz?
P c pn tk brzczy w gszcz?
Mhdv"</lang>
Mhdv"</syntaxhighlight>


=={{header|Arturo}}==
=={{header|Arturo}}==


<lang rebol>str: "Remove vowels from a string"
<syntaxhighlight lang="rebol">str: "Remove vowels from a string"


print str -- split "aeiouAEIOU"</lang>
print str -- split "aeiouAEIOU"</syntaxhighlight>


{{out}}
{{out}}
Line 386: Line 386:


=={{header|AutoHotkey}}==
=={{header|AutoHotkey}}==
<lang AutoHotkey>str := "The quick brown fox jumps over the lazy dog"
<syntaxhighlight lang="autohotkey">str := "The quick brown fox jumps over the lazy dog"
for i, v in StrSplit("aeiou")
for i, v in StrSplit("aeiou")
str := StrReplace(str, v)
str := StrReplace(str, v)
MsgBox % str</lang>
MsgBox % str</syntaxhighlight>
{{out}}
{{out}}
<pre>Th qck brwn fx jmps vr th lzy dg</pre>
<pre>Th qck brwn fx jmps vr th lzy dg</pre>
===RegEx Version===
===RegEx Version===
<lang AutoHotkey>str := "The quick brown fox jumps over the lazy dog"
<syntaxhighlight lang="autohotkey">str := "The quick brown fox jumps over the lazy dog"
MsgBox % str := RegExReplace(str, "i)[aeiou]")</lang>
MsgBox % str := RegExReplace(str, "i)[aeiou]")</syntaxhighlight>
{{out}}
{{out}}
<pre>Th qck brwn fx jmps vr th lzy dg</pre>
<pre>Th qck brwn fx jmps vr th lzy dg</pre>


=={{header|AWK}}==
=={{header|AWK}}==
<syntaxhighlight lang="awk">
<lang AWK>
# syntax: GAWK -f REMOVE_VOWELS_FROM_A_STRING.AWK
# syntax: GAWK -f REMOVE_VOWELS_FROM_A_STRING.AWK
BEGIN {
BEGIN {
Line 413: Line 413:
exit(0)
exit(0)
}
}
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 426: Line 426:
=={{header|BASIC}}==
=={{header|BASIC}}==
==={{header|Applesoft BASIC}}===
==={{header|Applesoft BASIC}}===
<lang gwbasic>S$ = "Remove a defined subset of glyphs from a string."</lang>
<syntaxhighlight lang="gwbasic">S$ = "Remove a defined subset of glyphs from a string."</syntaxhighlight>
<lang gwbasic>N$ = "": IF LEN (S$) THEN FOR I = 1 TO LEN (S$):C$ = MID$ (S$,I,1):K = ASC (C$):K$ = CHR$ (K - 32 * (K > 95)):V = 0: FOR C = 1 TO 5:V = V + ( MID$ ("AEIOU",C,1) = K$): NEXT C:N$ = N$ + MID$ (C$,V + 1): NEXT I: PRINT N$;</lang>
<syntaxhighlight lang="gwbasic">N$ = "": IF LEN (S$) THEN FOR I = 1 TO LEN (S$):C$ = MID$ (S$,I,1):K = ASC (C$):K$ = CHR$ (K - 32 * (K > 95)):V = 0: FOR C = 1 TO 5:V = V + ( MID$ ("AEIOU",C,1) = K$): NEXT C:N$ = N$ + MID$ (C$,V + 1): NEXT I: PRINT N$;</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 433: Line 433:
</pre>
</pre>
==={{header|BASIC256}}===
==={{header|BASIC256}}===
<lang BASIC256>mensaje$ = "If Peter Piper picked a pack of pickled peppers" + " or how many pickled peppers did Peter Piper pick?"
<syntaxhighlight lang="basic256">mensaje$ = "If Peter Piper picked a pack of pickled peppers" + " or how many pickled peppers did Peter Piper pick?"
textofinal$ = ""
textofinal$ = ""


Line 447: Line 447:


print textofinal$
print textofinal$
end</lang>
end</syntaxhighlight>


==={{header|PureBasic}}===
==={{header|PureBasic}}===
<lang PureBasic>OpenConsole()
<syntaxhighlight lang="purebasic">OpenConsole()
mensaje.s = "If Peter Piper picked a pack of pickled peppers" + " or how many pickled peppers did Peter Piper pick?"
mensaje.s = "If Peter Piper picked a pack of pickled peppers" + " or how many pickled peppers did Peter Piper pick?"
textofinal.s = ""
textofinal.s = ""
Line 466: Line 466:
PrintN(textofinal)
PrintN(textofinal)
Input()
Input()
CloseConsole()</lang>
CloseConsole()</syntaxhighlight>


==={{header|QBasic}}===
==={{header|QBasic}}===
{{works with|QBasic|1.1}}
{{works with|QBasic|1.1}}
{{works with|QuickBasic|4.5}}
{{works with|QuickBasic|4.5}}
<lang QBasic>mensaje$ = "If Peter Piper picked a pack of pickled peppers" + ", how many pickled peppers did Peter Piper pick?"
<syntaxhighlight lang="qbasic">mensaje$ = "If Peter Piper picked a pack of pickled peppers" + ", how many pickled peppers did Peter Piper pick?"
textofinal$ = ""
textofinal$ = ""


Line 485: Line 485:


print textofinal$
print textofinal$
end</lang>
end</syntaxhighlight>


==={{header|Yabasic}}===
==={{header|Yabasic}}===
<lang yabasic>mensaje$ = "If Peter Piper picked a pack of pickled peppers" + " : case how many pickled peppers did Peter Piper pick?"
<syntaxhighlight lang="yabasic">mensaje$ = "If Peter Piper picked a pack of pickled peppers" + " : case how many pickled peppers did Peter Piper pick?"
textofinal$ = ""
textofinal$ = ""


Line 502: Line 502:


print textofinal$
print textofinal$
end</lang>
end</syntaxhighlight>




=={{header|BCPL}}==
=={{header|BCPL}}==
<lang bcpl>get "libhdr"
<syntaxhighlight lang="bcpl">get "libhdr"


let vowel(c) = valof
let vowel(c) = valof
Line 526: Line 526:


let start() be
let start() be
writes(devowel("THE QUICK BROWN FOX jumps over the lazy dog.*N"))</lang>
writes(devowel("THE QUICK BROWN FOX jumps over the lazy dog.*N"))</syntaxhighlight>
{{out}}
{{out}}
<pre>TH QCK BRWN FX jmps vr th lzy dg.</pre>
<pre>TH QCK BRWN FX jmps vr th lzy dg.</pre>
Line 532: Line 532:
=={{header|C}}==
=={{header|C}}==
{{trans|Go}}
{{trans|Go}}
<lang c>#include <stdio.h>
<syntaxhighlight lang="c">#include <stdio.h>


void print_no_vowels(const char *s) {
void print_no_vowels(const char *s) {
Line 566: Line 566:
test("C Programming Language");
test("C Programming Language");
return 0;
return 0;
}</lang>
}</syntaxhighlight>
{{out}}
{{out}}
<pre>Input : C Programming Language
<pre>Input : C Programming Language
Line 572: Line 572:


=={{header|C#}}==
=={{header|C#}}==
<lang csharp>static string remove_vowels(string value)
<syntaxhighlight lang="csharp">static string remove_vowels(string value)
{
{
var stripped = from c in value.ToCharArray()
var stripped = from c in value.ToCharArray()
Line 591: Line 591:
test("CSharp Programming Language");
test("CSharp Programming Language");
}
}
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>Input: CSharp Programming Language
<pre>Input: CSharp Programming Language
Line 597: Line 597:


=={{header|C++}}==
=={{header|C++}}==
<lang cpp>#include <algorithm>
<syntaxhighlight lang="cpp">#include <algorithm>
#include <iostream>
#include <iostream>


Line 643: Line 643:
test("C++ Programming Language");
test("C++ Programming Language");
return 0;
return 0;
}</lang>
}</syntaxhighlight>
{{out}}
{{out}}
<pre>Input : C++ Programming Language
<pre>Input : C++ Programming Language
Line 650: Line 650:
=={{header|Common Lisp}}==
=={{header|Common Lisp}}==


<lang lisp>(defun vowel-p (c &optional (vowels "aeiou"))
<syntaxhighlight lang="lisp">(defun vowel-p (c &optional (vowels "aeiou"))
(and (characterp c) (characterp (find c vowels :test #'char-equal))))
(and (characterp c) (characterp (find c vowels :test #'char-equal))))


(defun remove-vowels (s)
(defun remove-vowels (s)
(and (stringp s) (remove-if #'vowel-p s)))</lang>
(and (stringp s) (remove-if #'vowel-p s)))</syntaxhighlight>


=={{header|Cowgol}}==
=={{header|Cowgol}}==
<lang cowgol>include "cowgol.coh";
<syntaxhighlight lang="cowgol">include "cowgol.coh";
include "strings.coh";
include "strings.coh";


Line 687: Line 687:
CopyString(str, &buf[0]); # make a copy of the string into writeable memory
CopyString(str, &buf[0]); # make a copy of the string into writeable memory
Devowel(&buf[0]); # remove the vowels
Devowel(&buf[0]); # remove the vowels
print(&buf[0]); # print the result </lang>
print(&buf[0]); # print the result </syntaxhighlight>


{{out}}
{{out}}
Line 694: Line 694:


=={{header|D}}==
=={{header|D}}==
<lang d>import std.stdio;
<syntaxhighlight lang="d">import std.stdio;


void print_no_vowels(string s) {
void print_no_vowels(string s) {
Line 711: Line 711:
void main() {
void main() {
print_no_vowels("D Programming Language");
print_no_vowels("D Programming Language");
}</lang>
}</syntaxhighlight>
{{out}}
{{out}}
<pre>D Prgrmmng Lngg</pre>
<pre>D Prgrmmng Lngg</pre>
Line 717: Line 717:
=={{header|Delphi}}==
=={{header|Delphi}}==
{{libheader| System.SysUtils}}
{{libheader| System.SysUtils}}
<syntaxhighlight lang="delphi">
<lang Delphi>
program Remove_vowels_from_a_string;
program Remove_vowels_from_a_string;


Line 750: Line 750:
end.
end.


</syntaxhighlight>
</lang>


{{out}}
{{out}}
Line 759: Line 759:


=={{header|F_Sharp|F#}}==
=={{header|F_Sharp|F#}}==
<lang fsharp>
<syntaxhighlight lang="fsharp">
let stripVowels n=let g=set['a';'e';'i';'o';'u';'A';'E';'I';'O';'U'] in n|>Seq.filter(fun n->not(g.Contains n))|>Array.ofSeq|>System.String
let stripVowels n=let g=set['a';'e';'i';'o';'u';'A';'E';'I';'O';'U'] in n|>Seq.filter(fun n->not(g.Contains n))|>Array.ofSeq|>System.String
printfn "%s" (stripVowels "Nigel Galloway")
printfn "%s" (stripVowels "Nigel Galloway")
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 769: Line 769:


=={{header|Factor}}==
=={{header|Factor}}==
<lang factor>USING: formatting kernel sets ;
<syntaxhighlight lang="factor">USING: formatting kernel sets ;


: without-vowels ( str -- new-str ) "aeiouAEIOU" without ;
: without-vowels ( str -- new-str ) "aeiouAEIOU" without ;


"Factor Programming Language" dup without-vowels
"Factor Programming Language" dup without-vowels
" Input string: %s\nWithout vowels: %s\n" printf</lang>
" Input string: %s\nWithout vowels: %s\n" printf</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 782: Line 782:


=={{header|Forth}}==
=={{header|Forth}}==
<lang forth>: VOWELS ( -- add len ) S" aeiouAEIOU" ;
<syntaxhighlight lang="forth">: VOWELS ( -- add len ) S" aeiouAEIOU" ;


: VALIDATE ( char addr len -- 0|n) ROT SCAN NIP ; \ find char in string
: VALIDATE ( char addr len -- 0|n) ROT SCAN NIP ; \ find char in string
Line 798: Line 798:
THEN
THEN
LOOP
LOOP
PAD COUNT ;</lang>
PAD COUNT ;</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 807: Line 807:


=={{header|Fortran}}==
=={{header|Fortran}}==
<lang fortran>
<syntaxhighlight lang="fortran">
program remove_vowels
program remove_vowels
implicit none
implicit none
Line 832: Line 832:
end subroutine print_no_vowels
end subroutine print_no_vowels
end program remove_vowels
end program remove_vowels
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 842: Line 842:


=={{header|FreeBASIC}}==
=={{header|FreeBASIC}}==
<lang FreeBASIC>dim as string message = "If Peter Piper picked a pack of pickled peppers"+_
<syntaxhighlight lang="freebasic">dim as string message = "If Peter Piper picked a pack of pickled peppers"+_
", how many pickled peppers did Peter Piper pick?"
", how many pickled peppers did Peter Piper pick?"
dim as string outstr = "", c
dim as string outstr = "", c
Line 856: Line 856:
next i
next i


print outstr</lang>
print outstr</syntaxhighlight>


=={{header|Free Pascal}}==
=={{header|Free Pascal}}==
''See also [[#Pascal|Pascal]]''
''See also [[#Pascal|Pascal]]''
{{libheader|strUtils}}
{{libheader|strUtils}}
<lang pascal>{$longStrings on}
<syntaxhighlight lang="pascal">{$longStrings on}
uses
uses
strUtils;
strUtils;
Line 874: Line 874:
end;
end;
writeLn(line)
writeLn(line)
end.</lang>
end.</syntaxhighlight>


=={{header|Fōrmulæ}}==
=={{header|Fōrmulæ}}==
Line 885: Line 885:


=={{header|Go}}==
=={{header|Go}}==
<lang go>package main
<syntaxhighlight lang="go">package main


import (
import (
Line 907: Line 907:
fmt.Println("Input :", s)
fmt.Println("Input :", s)
fmt.Println("Output :", removeVowels(s))
fmt.Println("Output :", removeVowels(s))
}</lang>
}</syntaxhighlight>


{{out}}
{{out}}
Line 919: Line 919:
Removing three specific Anglo-Saxon vowels from a text, using a general method which can apply to any specific subset of glyphs.
Removing three specific Anglo-Saxon vowels from a text, using a general method which can apply to any specific subset of glyphs.


<lang haskell>------ REMOVE A SPECIFIC SUBSET OF GLYPHS FROM A STRING ----
<syntaxhighlight lang="haskell">------ REMOVE A SPECIFIC SUBSET OF GLYPHS FROM A STRING ----
exceptGlyphs :: String -> String -> String
exceptGlyphs :: String -> String -> String
Line 936: Line 936:
main :: IO ()
main :: IO ()
main = putStrLn $ exceptGlyphs "eau" txt</lang>
main = putStrLn $ exceptGlyphs "eau" txt</syntaxhighlight>


or, in terms of filter:
or, in terms of filter:
<lang haskell>exceptGlyphs :: String -> String -> String
<syntaxhighlight lang="haskell">exceptGlyphs :: String -> String -> String
exceptGlyphs = filter . flip notElem</lang>
exceptGlyphs = filter . flip notElem</syntaxhighlight>


{{Out}}
{{Out}}
Line 951: Line 951:


=={{header|Java}}==
=={{header|Java}}==
<lang java>public static String removeVowelse(String str){
<syntaxhighlight lang="java">public static String removeVowelse(String str){
String re = "";
String re = "";
char c;
char c;
Line 960: Line 960:
}
}
return re;
return re;
}</lang>
}</syntaxhighlight>


=={{header|JavaScript}}==
=={{header|JavaScript}}==
Line 968: Line 968:
( ''Pace'' Jamie Zawinski, some people, when confronted with a problem, think "I know, I'll use '''parser combinators'''." )
( ''Pace'' Jamie Zawinski, some people, when confronted with a problem, think "I know, I'll use '''parser combinators'''." )


<lang javascript>(() => {
<syntaxhighlight lang="javascript">(() => {
'use strict'
'use strict'


Line 1,231: Line 1,231:
// main ---
// main ---
return main();
return main();
})();</lang>
})();</syntaxhighlight>
{{Out}}
{{Out}}
<pre> Rostt Cod is progrmming chrstomthy sit.
<pre> Rostt Cod is progrmming chrstomthy sit.
Line 1,243: Line 1,243:
but a filter is all we need here:
but a filter is all we need here:


<lang javascript>(() => {
<syntaxhighlight lang="javascript">(() => {
'use strict';
'use strict';


Line 1,267: Line 1,267:
// main ---
// main ---
return main();
return main();
})();</lang>
})();</syntaxhighlight>
{{Out}}
{{Out}}
<pre> Rostt Cod is progrmming chrstomthy sit.
<pre> Rostt Cod is progrmming chrstomthy sit.
Line 1,279: Line 1,279:
{{works with|jq}}
{{works with|jq}}
'''Works with gojq, the Go implementation of jq'''
'''Works with gojq, the Go implementation of jq'''
<syntaxhighlight lang="sh">
<lang sh>
#!/bin/bash
#!/bin/bash


Line 1,313: Line 1,313:


input | jq -Rr --arg v "$vowels" 'gsub("[\($v)]+"; ""; "i")'
input | jq -Rr --arg v "$vowels" 'gsub("[\($v)]+"; ""; "i")'
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 1,343: Line 1,343:
=={{header|Julia}}==
=={{header|Julia}}==
Unicode sensitive, using the Raku version example text.
Unicode sensitive, using the Raku version example text.
<lang julia>const ALLVOWELS = Dict(ch => 1 for ch in Vector{Char}("AÀÁÂÃÄÅĀĂĄǺȀȂẠẢẤẦẨẪẬẮẰẲẴẶḀÆǼEȄȆḔḖḘḚḜẸẺẼẾỀỂỄỆĒĔĖĘĚÈÉÊËIȈȊḬḮỈỊĨĪĬĮİÌÍÎÏIJOŒØǾȌȎṌṎṐṒỌỎỐỒỔỖỘỚỜỞỠỢŌÒÓŎŐÔÕÖUŨŪŬŮŰŲÙÚÛÜȔȖṲṴṶṸṺỤỦỨỪỬỮỰ"))
<syntaxhighlight lang="julia">const ALLVOWELS = Dict(ch => 1 for ch in Vector{Char}("AÀÁÂÃÄÅĀĂĄǺȀȂẠẢẤẦẨẪẬẮẰẲẴẶḀÆǼEȄȆḔḖḘḚḜẸẺẼẾỀỂỄỆĒĔĖĘĚÈÉÊËIȈȊḬḮỈỊĨĪĬĮİÌÍÎÏIJOŒØǾȌȎṌṎṐṒỌỎỐỒỔỖỘỚỜỞỠỢŌÒÓŎŐÔÕÖUŨŪŬŮŰŲÙÚÛÜȔȖṲṴṶṸṺỤỦỨỪỬỮỰ"))
const ALLVOWELSY = Dict(ch => 1 for ch in Vector{Char}("AÀÁÂÃÄÅĀĂĄǺȀȂẠẢẤẦẨẪẬẮẰẲẴẶḀÆǼEȄȆḔḖḘḚḜẸẺẼẾỀỂỄỆĒĔĖĘĚÈÉÊËIȈȊḬḮỈỊĨĪĬĮİÌÍÎÏIJOŒØǾȌȎṌṎṐṒỌỎỐỒỔỖỘỚỜỞỠỢŌÒÓŎŐÔÕÖUŨŪŬŮŰŲÙÚÛÜȔȖṲṴṶṸṺỤỦỨỪỬỮỰYẙỲỴỶỸŶŸÝ"))
const ALLVOWELSY = Dict(ch => 1 for ch in Vector{Char}("AÀÁÂÃÄÅĀĂĄǺȀȂẠẢẤẦẨẪẬẮẰẲẴẶḀÆǼEȄȆḔḖḘḚḜẸẺẼẾỀỂỄỆĒĔĖĘĚÈÉÊËIȈȊḬḮỈỊĨĪĬĮİÌÍÎÏIJOŒØǾȌȎṌṎṐṒỌỎỐỒỔỖỘỚỜỞỠỢŌÒÓŎŐÔÕÖUŨŪŬŮŰŲÙÚÛÜȔȖṲṴṶṸṺỤỦỨỪỬỮỰYẙỲỴỶỸŶŸÝ"))


Line 1,360: Line 1,360:
println("Removing vowels from:\n$testtext\n becomes:\n",
println("Removing vowels from:\n$testtext\n becomes:\n",
String(filter(!isvowel, Vector{Char}(testtext))))
String(filter(!isvowel, Vector{Char}(testtext))))
</lang>{{out}}
</syntaxhighlight>{{out}}
<pre>
<pre>
Removing vowels from:
Removing vowels from:
Line 1,383: Line 1,383:


=={{header|Kotlin}}==
=={{header|Kotlin}}==
<lang scala>fun removeVowels(s: String): String {
<syntaxhighlight lang="scala">fun removeVowels(s: String): String {
val re = StringBuilder()
val re = StringBuilder()
for (c in s) {
for (c in s) {
Line 1,399: Line 1,399:
fun main() {
fun main() {
println(removeVowels("Kotlin Programming Language"))
println(removeVowels("Kotlin Programming Language"))
}</lang>
}</syntaxhighlight>
{{out}}
{{out}}
<pre>Ktln Prgrmmng Lngg</pre>
<pre>Ktln Prgrmmng Lngg</pre>


=={{header|Lambdatalk}}==
=={{header|Lambdatalk}}==
<syntaxhighlight lang="scheme">
<lang Scheme>
'{S.replace [aeiouy]* by in
'{S.replace [aeiouy]* by in
Rosetta Code is a programming chrestomathy site.
Rosetta Code is a programming chrestomathy site.
Line 1,414: Line 1,414:


-> Rstt Cd s prgrmmng chrstmth st. Th d s t prsnt sltns t th sm tsk n s mn dffrnt lnggs s pssbl, t dmnstrt hw lnggs r smlr nd dffrnt, nd t d prsn wth grndng n n pprch t prblm n lrnng nthr.
-> Rstt Cd s prgrmmng chrstmth st. Th d s t prsnt sltns t th sm tsk n s mn dffrnt lnggs s pssbl, t dmnstrt hw lnggs r smlr nd dffrnt, nd t d prsn wth grndng n n pprch t prblm n lrnng nthr.
</syntaxhighlight>
</lang>


=={{header|Lua}}==
=={{header|Lua}}==
<lang lua>function removeVowels (inStr)
<syntaxhighlight lang="lua">function removeVowels (inStr)
local outStr, letter = ""
local outStr, letter = ""
local vowels = "AEIUOaeiou"
local vowels = "AEIUOaeiou"
Line 1,432: Line 1,432:


local testStr = "The quick brown fox jumps over the lazy dog"
local testStr = "The quick brown fox jumps over the lazy dog"
print(removeVowels(testStr))</lang>
print(removeVowels(testStr))</syntaxhighlight>
{{out}}
{{out}}
<pre>Th qck brwn fx jmps vr th lzy dg</pre>
<pre>Th qck brwn fx jmps vr th lzy dg</pre>
Line 1,440: Line 1,440:


=={{header|Mathematica}}/{{header|Wolfram Language}}==
=={{header|Mathematica}}/{{header|Wolfram Language}}==
<lang Mathematica>StringReplace["The Quick Brown Fox Jumped Over the Lazy Dog's Back", (Alternatives @@ Characters["aeiou"]) -> ""]</lang>
<syntaxhighlight lang="mathematica">StringReplace["The Quick Brown Fox Jumped Over the Lazy Dog's Back", (Alternatives @@ Characters["aeiou"]) -> ""]</syntaxhighlight>
{{out}}
{{out}}
<pre>Th Qck Brwn Fx Jmpd Ovr th Lzy Dg's Bck</pre>
<pre>Th Qck Brwn Fx Jmpd Ovr th Lzy Dg's Bck</pre>


=={{header|MATLAB}} / {{header|Octave}}==
=={{header|MATLAB}} / {{header|Octave}}==
<syntaxhighlight lang="matlab">
<lang Matlab>
function [result] = remove_vowels(text)
function [result] = remove_vowels(text)
% http://rosettacode.org/wiki/Remove_vowels_from_a_string
% http://rosettacode.org/wiki/Remove_vowels_from_a_string
Line 1,463: Line 1,463:
%!test
%!test
%! assert(remove_vowels('The quick brown fox jumps over the lazy dog'),'Th qck brwn fx jmps vr th lzy dg')
%! assert(remove_vowels('The quick brown fox jumps over the lazy dog'),'Th qck brwn fx jmps vr th lzy dg')
</syntaxhighlight>
</lang>


{{out}}
{{out}}
Line 1,472: Line 1,472:


=={{header|Nim}}==
=={{header|Nim}}==
<lang Nim>import strutils, sugar
<syntaxhighlight lang="nim">import strutils, sugar


const Vowels = {'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'}
const Vowels = {'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'}
Line 1,487: Line 1,487:
const TestString = "The quick brown fox jumps over the lazy dog"
const TestString = "The quick brown fox jumps over the lazy dog"
echo TestString
echo TestString
echo TestString.dup(removeVowels(Vowels))</lang>
echo TestString.dup(removeVowels(Vowels))</syntaxhighlight>


{{out}}
{{out}}
Line 1,496: Line 1,496:
''See also [[#Delphi|Delphi]] or [[#Free Pascal|Free Pascal]]''<br/>
''See also [[#Delphi|Delphi]] or [[#Free Pascal|Free Pascal]]''<br/>
This program works with any ISO 7185 compliant compiler.
This program works with any ISO 7185 compliant compiler.
<lang pascal>program removeVowelsFromString(input, output);
<syntaxhighlight lang="pascal">program removeVowelsFromString(input, output);


const
const
Line 1,570: Line 1,570:
end;
end;
writeLn
writeLn
end.</lang>
end.</syntaxhighlight>
{{in}}
{{in}}
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Line 1,578: Line 1,578:
{{works with|Extended Pascal}}
{{works with|Extended Pascal}}
More convenient though is to use some Extended Pascal (ISO 10206) features:
More convenient though is to use some Extended Pascal (ISO 10206) features:
<lang pascal>program removeVowelsFromString(input, output);
<syntaxhighlight lang="pascal">program removeVowelsFromString(input, output);
const
const
vowels = ['A', 'E', 'I', 'O', 'U', 'a', 'e', 'i', 'o', 'u'];
vowels = ['A', 'E', 'I', 'O', 'U', 'a', 'e', 'i', 'o', 'u'];
Line 1,598: Line 1,598:
writeLn(disemvoweledLine)
writeLn(disemvoweledLine)
end.</lang>
end.</syntaxhighlight>
{{in}}
{{in}}
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Line 1,606: Line 1,606:
=={{header|Perl}}==
=={{header|Perl}}==
Inspired by the Raku entry.
Inspired by the Raku entry.
<lang perl>use strict;
<syntaxhighlight lang="perl">use strict;
use warnings;
use warnings;
use utf8;
use utf8;
Line 1,625: Line 1,625:
my @vowels;
my @vowels;
chr($_) =~ /[aæeiıoœu]/i and push @vowels, chr($_) for 0x20 .. 0x1ff;
chr($_) =~ /[aæeiıoœu]/i and push @vowels, chr($_) for 0x20 .. 0x1ff;
print NFD($_) =~ /@{[join '|', @vowels]}/ ? ' ' : $_ for split /(\X)/, $text;</lang>
print NFD($_) =~ /@{[join '|', @vowels]}/ ? ' ' : $_ for split /(\X)/, $text;</syntaxhighlight>
{{out}}
{{out}}
<pre>N rw g n, c l nd c, G rm n, T rk sh, Fr nch, Sp n sh, ngl sh:
<pre>N rw g n, c l nd c, G rm n, T rk sh, Fr nch, Sp n sh, ngl sh:
Line 1,637: Line 1,637:


=={{header|Phix}}==
=={{header|Phix}}==
<!--<lang Phix>(phixonline)-->
<!--<syntaxhighlight lang="phix">(phixonline)-->
<span style="color: #008080;">constant</span> <span style="color: #000000;">s</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">"Phix Programming Language"</span>
<span style="color: #008080;">constant</span> <span style="color: #000000;">s</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">"Phix Programming Language"</span>
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Input : %s\nOutput : %s\n"</span><span style="color: #0000FF;">,{</span><span style="color: #000000;">s</span><span style="color: #0000FF;">,</span><span style="color: #7060A8;">filter</span><span style="color: #0000FF;">(</span><span style="color: #000000;">s</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"out"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"aeiouAEIUO"</span><span style="color: #0000FF;">)})</span>
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Input : %s\nOutput : %s\n"</span><span style="color: #0000FF;">,{</span><span style="color: #000000;">s</span><span style="color: #0000FF;">,</span><span style="color: #7060A8;">filter</span><span style="color: #0000FF;">(</span><span style="color: #000000;">s</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"out"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"aeiouAEIUO"</span><span style="color: #0000FF;">)})</span>
<!--</lang>-->
<!--</syntaxhighlight>-->
{{out}}
{{out}}
<pre>
<pre>
Line 1,647: Line 1,647:
</pre>
</pre>
If you want something a bit more like Julia/Raku, the following should work, but you have to provide your own vowel-set, or nick/merge from Julia/REXX
If you want something a bit more like Julia/Raku, the following should work, but you have to provide your own vowel-set, or nick/merge from Julia/REXX
<!--<lang Phix>(phixonline)-->
<!--<syntaxhighlight lang="phix">(phixonline)-->
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
Line 1,672: Line 1,672:
<span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"%s\n"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">remove_vowels</span><span style="color: #0000FF;">(</span><span style="color: #000000;">s</span><span style="color: #0000FF;">))</span>
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"%s\n"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">remove_vowels</span><span style="color: #0000FF;">(</span><span style="color: #000000;">s</span><span style="color: #0000FF;">))</span>
<!--</lang>-->
<!--</syntaxhighlight>-->
(output deliberately not shown due to windows console effects, but it is the same as Raku, or Julia with the alternate find/replace line.)
(output deliberately not shown due to windows console effects, but it is the same as Raku, or Julia with the alternate find/replace line.)


=={{header|Picat}}==
=={{header|Picat}}==
<lang Picat>main =>
<syntaxhighlight lang="picat">main =>
println("The Quick Brown Fox Jumped Over the Lazy Dog's Back".remove_vowels),
println("The Quick Brown Fox Jumped Over the Lazy Dog's Back".remove_vowels),
println("Picat programming language".remove_vowels).
println("Picat programming language".remove_vowels).


remove_vowels(S) = [C : C in S, not membchk(C,"AEIOUaeiou")].</lang>
remove_vowels(S) = [C : C in S, not membchk(C,"AEIOUaeiou")].</syntaxhighlight>


{{out}}
{{out}}
Line 1,691: Line 1,691:




<syntaxhighlight lang="prolog">
<lang Prolog>
:- system:set_prolog_flag(double_quotes,chars) .
:- system:set_prolog_flag(double_quotes,chars) .


Line 1,728: Line 1,728:
lists:member(CHAR,"AEIOUaeiouüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜáíóúªºαΩ")
lists:member(CHAR,"AEIOUaeiouüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜáíóúªºαΩ")
.
.
</syntaxhighlight>
</lang>


{{out}}
{{out}}
Line 1,754: Line 1,754:


{{works with|Python|3.7|}}
{{works with|Python|3.7|}}
<lang python>'''Remove a defined subset of glyphs from a string'''
<syntaxhighlight lang="python">'''Remove a defined subset of glyphs from a string'''




Line 1,789: Line 1,789:
# MAIN ---
# MAIN ---
if __name__ == '__main__':
if __name__ == '__main__':
main()</lang>
main()</syntaxhighlight>
{{Out}}
{{Out}}
<pre> Rostt Cod is progrmming chrstomthy sit.
<pre> Rostt Cod is progrmming chrstomthy sit.
Line 1,800: Line 1,800:
===One liner===
===One liner===
Well, almost........
Well, almost........
<syntaxhighlight lang="python">
<lang Python>
txt = '''
txt = '''
Rosetta Code is a programming chrestomathy site.
Rosetta Code is a programming chrestomathy site.
Line 1,810: Line 1,810:


print(''.join(list(filter(lambda a: a not in "aeiou",txt))))
print(''.join(list(filter(lambda a: a not in "aeiou",txt))))
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 1,822: Line 1,822:


=={{header|Quackery}}==
=={{header|Quackery}}==
<lang Quackery>[ 0 $ "AEIOUaeiou"
<syntaxhighlight lang="quackery">[ 0 $ "AEIOUaeiou"
witheach
witheach
[ bit | ] ] constant is vowels ( --> f )
[ bit | ] ] constant is vowels ( --> f )
Line 1,833: Line 1,833:
$ '"Beautiful coquettes are quacks of love."'
$ '"Beautiful coquettes are quacks of love."'
$ ' -- Francois De La Rochefoucauld' join
$ ' -- Francois De La Rochefoucauld' join
disemvowel echo$</lang>
disemvowel echo$</syntaxhighlight>


'''Output:'''
'''Output:'''
Line 1,851: Line 1,851:
Strings from http://mylanguages.org/. No affiliation, but it's a nice resource. (note: these are not all the same sentence but are all from the same paragraph. They frankly were picked based on their vowel load.)
Strings from http://mylanguages.org/. No affiliation, but it's a nice resource. (note: these are not all the same sentence but are all from the same paragraph. They frankly were picked based on their vowel load.)


<lang perl6>my @vowels = (0x20 .. 0x2fff).map: { .chr if .chr.samemark('x') ~~ m:i/<[aæeiıoœu]>/ }
<syntaxhighlight lang="raku" line>my @vowels = (0x20 .. 0x2fff).map: { .chr if .chr.samemark('x') ~~ m:i/<[aæeiıoœu]>/ }


my $text = q:to/END/;
my $text = q:to/END/;
Line 1,864: Line 1,864:
END
END


put $text.subst(/@vowels/, ' ', :g);</lang>
put $text.subst(/@vowels/, ' ', :g);</syntaxhighlight>
{{out}}
{{out}}
<pre>N rw g n, c l nd c, G rm n, T rk sh, Fr nch, Sp n sh, ngl sh:
<pre>N rw g n, c l nd c, G rm n, T rk sh, Fr nch, Sp n sh, ngl sh:
Line 1,880: Line 1,880:
=== using the TRANSLATE BIF ===
=== using the TRANSLATE BIF ===
This REXX version uses the &nbsp; '''translate''' &nbsp; BIF which works faster for longer strings as there is no character-by-character manipulation.
This REXX version uses the &nbsp; '''translate''' &nbsp; BIF which works faster for longer strings as there is no character-by-character manipulation.
<lang rexx>/*REXX program removes vowels (both lowercase and uppercase and accented) from a string.*/
<syntaxhighlight lang="rexx">/*REXX program removes vowels (both lowercase and uppercase and accented) from a string.*/
parse arg x /*obtain optional argument from the CL.*/
parse arg x /*obtain optional argument from the CL.*/
if x='' | x="," then x= 'REXX Programming Language' /*Not specified? Then use default*/
if x='' | x="," then x= 'REXX Programming Language' /*Not specified? Then use default*/
Line 1,890: Line 1,890:
y= space(translate(y, , vowels), 0) /*trans. vowels──►blanks, elide blanks.*/
y= space(translate(y, , vowels), 0) /*trans. vowels──►blanks, elide blanks.*/
y= translate(y, , q) /*trans the Q characters back to blanks*/
y= translate(y, , q) /*trans the Q characters back to blanks*/
say 'output string: ' y /*stick a fork in it, we're all done. */</lang>
say 'output string: ' y /*stick a fork in it, we're all done. */</syntaxhighlight>
{{out|output|text=&nbsp; when using the default input:}}
{{out|output|text=&nbsp; when using the default input:}}
<pre>
<pre>
Line 1,899: Line 1,899:
=== using character eliding ===
=== using character eliding ===
This REXX version uses a character-by-character manipulation and should be easier to understand.
This REXX version uses a character-by-character manipulation and should be easier to understand.
<lang rexx>/*REXX program removes vowels (both lowercase and uppercase and accented) from a string.*/
<syntaxhighlight lang="rexx">/*REXX program removes vowels (both lowercase and uppercase and accented) from a string.*/
parse arg x /*obtain optional argument from the CL.*/
parse arg x /*obtain optional argument from the CL.*/
if x='' | x="," then x= 'REXX Programming Language' /*Not specified? Then use default*/
if x='' | x="," then x= 'REXX Programming Language' /*Not specified? Then use default*/
Line 1,913: Line 1,913:


x= substr(x, 2) /*elide the prefixed dummy character. */
x= substr(x, 2) /*elide the prefixed dummy character. */
say 'output string: ' x /*stick a fork in it, we're all done. */</lang>
say 'output string: ' x /*stick a fork in it, we're all done. */</syntaxhighlight>
{{out|output|text=&nbsp; is identical to the 1<sup>st</sup> REXX version.}} <br><br>
{{out|output|text=&nbsp; is identical to the 1<sup>st</sup> REXX version.}} <br><br>


=={{header|Ring}}==
=={{header|Ring}}==
<lang ring>
<syntaxhighlight lang="ring">
load "stdlib.ring"
load "stdlib.ring"
str = "Ring Programming Language"
str = "Ring Programming Language"
Line 1,927: Line 1,927:
next
next
see "String without vowels: " + str + nl
see "String without vowels: " + str + nl
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 1,934: Line 1,934:
</pre>
</pre>
=={{header|Ruby}}==
=={{header|Ruby}}==
<lang ruby>
<syntaxhighlight lang="ruby">
p "Remove vowels from a string".delete("aeiouAEIOU") # => "Rmv vwls frm strng"
p "Remove vowels from a string".delete("aeiouAEIOU") # => "Rmv vwls frm strng"
</syntaxhighlight>
</lang>


=={{header|Rust}}==
=={{header|Rust}}==
<lang rust>
<syntaxhighlight lang="rust">
fn remove_vowels(str: String) -> String {
fn remove_vowels(str: String) -> String {
let vowels = "aeiouAEIOU";
let vowels = "aeiouAEIOU";
Line 1,960: Line 1,960:
println!("{}", remove_vowels(intro));
println!("{}", remove_vowels(intro));
}
}
</syntaxhighlight>
</lang>
Output :
Output :
<pre>
<pre>
Line 1,968: Line 1,968:


=={{header|Smalltalk}}==
=={{header|Smalltalk}}==
<lang smalltalk>in := 'The balloon above harsh waters of programming languages, is the mascot of Smalltalk'.
<syntaxhighlight lang="smalltalk">in := 'The balloon above harsh waters of programming languages, is the mascot of Smalltalk'.
out := in reject:[:ch | ch isVowel].
out := in reject:[:ch | ch isVowel].
in printCR.
in printCR.
out printCR.</lang>
out printCR.</syntaxhighlight>
{{out}}
{{out}}
<pre>The balloon above harsh harsh waters of programming languages, is the mascot of Smalltalk
<pre>The balloon above harsh harsh waters of programming languages, is the mascot of Smalltalk
Line 1,977: Line 1,977:


As usual, there are many alternative ways to do this:
As usual, there are many alternative ways to do this:
<lang smalltalk>out := in reject:#isVowel. " cool: symbols understand value: "
<syntaxhighlight lang="smalltalk">out := in reject:#isVowel. " cool: symbols understand value: "


out := in select:[:ch | ch isVowel not].
out := in select:[:ch | ch isVowel not].
Line 1,991: Line 1,991:
ch isVowel ifFalse:[ s nextPut:ch ]
ch isVowel ifFalse:[ s nextPut:ch ]
]]
]]
</syntaxhighlight>
</lang>


=={{header|Standard ML}}==
=={{header|Standard ML}}==
<lang sml>fun isVowel c =
<syntaxhighlight lang="sml">fun isVowel c =
CharVector.exists (fn v => c = v) "AaEeIiOoUu"
CharVector.exists (fn v => c = v) "AaEeIiOoUu"


Line 2,002: Line 2,002:
val str = "LOREM IPSUM dolor sit amet\n"
val str = "LOREM IPSUM dolor sit amet\n"
val () = print str
val () = print str
val () = print (removeVowels str)</lang>
val () = print (removeVowels str)</syntaxhighlight>
{{out}}
{{out}}
<pre>LOREM IPSUM dolor sit amet
<pre>LOREM IPSUM dolor sit amet
Line 2,008: Line 2,008:


=={{header|Swift}}==
=={{header|Swift}}==
<lang swift>func isVowel(_ char: Character) -> Bool {
<syntaxhighlight lang="swift">func isVowel(_ char: Character) -> Bool {
switch (char) {
switch (char) {
case "a", "A", "e", "E", "i", "I", "o", "O", "u", "U":
case "a", "A", "e", "E", "i", "I", "o", "O", "u", "U":
Line 2,023: Line 2,023:
let str = "The Swift Programming Language"
let str = "The Swift Programming Language"
print(str)
print(str)
print(removeVowels(string: str))</lang>
print(removeVowels(string: str))</syntaxhighlight>


{{out}}
{{out}}
Line 2,032: Line 2,032:


=={{header|Visual Basic .NET}}==
=={{header|Visual Basic .NET}}==
<lang vbnet>Imports System.Text
<syntaxhighlight lang="vbnet">Imports System.Text


Module Module1
Module Module1
Line 2,062: Line 2,062:
End Sub
End Sub


End Module</lang>
End Module</syntaxhighlight>
{{out}}
{{out}}
<pre>Input : Visual Basic .NET
<pre>Input : Visual Basic .NET
Line 2,070: Line 2,070:
{{trans|AutoHotkey}}
{{trans|AutoHotkey}}


<lang vlang>fn main() {
<syntaxhighlight lang="vlang">fn main() {
mut str := 'The quick brown fox jumps over the lazy dog'
mut str := 'The quick brown fox jumps over the lazy dog'
for val in 'aeiou'.split('') {str = str.replace(val,'')}
for val in 'aeiou'.split('') {str = str.replace(val,'')}
println(str)
println(str)
}</lang>
}</syntaxhighlight>


{{out}}
{{out}}
Line 2,082: Line 2,082:


=={{header|Wren}}==
=={{header|Wren}}==
<lang ecmascript>var removeVowels = Fn.new { |s| s.where { |c| !"aeiouAEIOU".contains(c) }.join() }
<syntaxhighlight lang="ecmascript">var removeVowels = Fn.new { |s| s.where { |c| !"aeiouAEIOU".contains(c) }.join() }


var s = "Wren Programming Language"
var s = "Wren Programming Language"
System.print("Input : %(s)")
System.print("Input : %(s)")
System.print("Output : %(removeVowels.call(s))")</lang>
System.print("Output : %(removeVowels.call(s))")</syntaxhighlight>


{{out}}
{{out}}
Line 2,095: Line 2,095:


=={{header|XBS}}==
=={{header|XBS}}==
<lang xbs>func RemoveVowels(x:string):string{
<syntaxhighlight lang="xbs">func RemoveVowels(x:string):string{
set Vowels:array="aeiou"::split();
set Vowels:array="aeiou"::split();
set nx:string="";
set nx:string="";
Line 2,109: Line 2,109:
}
}


log(RemoveVowels("Hello, world!"));</lang>
log(RemoveVowels("Hello, world!"));</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 2,116: Line 2,116:


=={{header|XPL0}}==
=={{header|XPL0}}==
<lang XPL0>string 0; \make strings zero-terminated
<syntaxhighlight lang="xpl0">string 0; \make strings zero-terminated


func Disemvowel(S); \remove vowels from string
func Disemvowel(S); \remove vowels from string
Line 2,130: Line 2,130:
];
];


Text(0, Disemvowel("pack my box with FIVE DOZEN LIQUOR JUGS!"))</lang>
Text(0, Disemvowel("pack my box with FIVE DOZEN LIQUOR JUGS!"))</syntaxhighlight>


Output:
Output:
Line 2,138: Line 2,138:


=={{header|XProfan}}==
=={{header|XProfan}}==
<syntaxhighlight lang="xprofan">cls
<lang XProfan>cls
Set("RegEx",1)
Set("RegEx",1)
Var string e = "The quick brown fox jumps over the lazy dog"
Var string e = "The quick brown fox jumps over the lazy dog"
Var string a = Translate$(e,"(?i)[aeiou]","")
Var string a = Translate$(e,"(?i)[aeiou]","")
MessageBox("Input : "+e+"\nOutput: "+a,"Remove vowels",1)
MessageBox("Input : "+e+"\nOutput: "+a,"Remove vowels",1)
End</lang>
End</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>