Remove vowels from a string: Difference between revisions
m
→{{header|EasyLang}}
(22 intermediate revisions by 15 users not shown) | |||
Line 9:
{{trans|Python}}
<
R s.filter(c -> c !C @exclusions).join(‘’)
Line 20:
in one approach to a problem in learning another.’
print(exceptGlyphs(‘eau’, txt))</
{{out}}
Line 35:
=={{header|8080 Assembly}}==
<
jmp demo
;;; Remove the vowels from the $-terminated string at [DE]
Line 65:
mvi c,9 ; Print using CP/M
jmp 5
string: db 'THE QUICK BROWN FOX jumps over the lazy dog$'</
{{out}}
Line 72:
=={{header|Action!}}==
<
CHAR ARRAY vovels="AEIOUaeiou"
BYTE i
Line 110:
Test("The Quick Brown Fox Jumped Over the Lazy Dog's Back")
Test("Action! is a programming language for Atari 8-bit computer.")
RETURN</
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Remove_vowels_from_a_string.png Screenshot from Atari 8-bit computer]
Line 126:
=={{header|Ada}}==
<
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
Line 156:
Put_Line (NV2);
end Main;
</syntaxhighlight>
{{output}}
<pre>
Line 167:
=={{header|ALGOL 68}}==
<
# returns s with the vowels removed #
OP DEVOWEL = ( STRING s )STRING:
Line 191:
test devowel( "abcdefghijklmnoprstuvwxyz" );
test devowel( "Algol 68 Programming Language" )
END</
{{out}}
<pre>
Line 202:
=={{header|APL}}==
<syntaxhighlight lang
{{out}}
<pre> devowel 'THE QUICK BROWN FOX jumps over the lazy dog'
Line 217:
We can also improve productivity by using library functions whenever feasible.
<
-- exceptGlyphs :: String -> String -> Bool
Line 324:
set my text item delimiters to dlm
s
end unlines</
{{Out}}
<pre>Rostt Cod is progrmming chrstomthy sit.
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.
<
-- searchText can be either a single string or a list of strings to be replaced with replacementText.
on replace(mainText, searchText, replacementText)
Line 363:
set devowelledText to replace(txt, {"a", "e", "i", "o", "u"}, "")
end ignoring
return devowelledText</
{{output}}
<
L'œvr d'n lv
vn Dijk
Line 373:
Jř Blhlvk cndcts Mrtn
P c pn tk brzczy w gszcz?
Mhdv"</
=={{header|Arturo}}==
<
print str -- split "aeiouAEIOU"</
{{out}}
Line 386:
=={{header|AutoHotkey}}==
<
for i, v in StrSplit("aeiou")
str := StrReplace(str, v)
MsgBox % str</
{{out}}
<pre>Th qck brwn fx jmps vr th lzy dg</pre>
===RegEx Version===
<
MsgBox % str := RegExReplace(str, "i)[aeiou]")</
{{out}}
<pre>Th qck brwn fx jmps vr th lzy dg</pre>
=={{header|AWK}}==
<syntaxhighlight lang="awk">
# syntax: GAWK -f REMOVE_VOWELS_FROM_A_STRING.AWK
BEGIN {
Line 413:
exit(0)
}
</syntaxhighlight>
{{out}}
<pre>
Line 425:
=={{header|BASIC}}==
==={{header|Applesoft BASIC}}===
<syntaxhighlight lang="gwbasic">S$ = "Remove a defined subset of glyphs from a string."</syntaxhighlight>
<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}}
<pre>
Rmv dfnd sbst f glyphs frm strng.
</pre>
==={{header|BASIC256}}===
<
textofinal$ = ""
Line 440 ⟶ 447:
print textofinal$
end</
==={{header|PureBasic}}===
<
mensaje.s = "If Peter Piper picked a pack of pickled peppers" + " or how many pickled peppers did Peter Piper pick?"
textofinal.s = ""
Line 459 ⟶ 466:
PrintN(textofinal)
Input()
CloseConsole()</
==={{header|QBasic}}===
{{works with|QBasic|1.1}}
{{works with|QuickBasic|4.5}}
<
textofinal$ = ""
Line 478 ⟶ 485:
print textofinal$
end</
==={{header|Yabasic}}===
<
textofinal$ = ""
Line 495 ⟶ 502:
print textofinal$
end</
=={{header|BCPL}}==
<
let vowel(c) = valof
Line 519 ⟶ 526:
let start() be
writes(devowel("THE QUICK BROWN FOX jumps over the lazy dog.*N"))</
{{out}}
<pre>TH QCK BRWN FX jmps vr th lzy dg.</pre>
=={{header|BQN}}==
<syntaxhighlight lang="bqn">Devowel ← ¬∘∊⟜"AaEeIiOoUu"⊸/</syntaxhighlight>
=={{header|C}}==
{{trans|Go}}
<
void print_no_vowels(const char *s) {
Line 559 ⟶ 569:
test("C Programming Language");
return 0;
}</
{{out}}
<pre>Input : C Programming Language
Line 565 ⟶ 575:
=={{header|C#}}==
<
{
var stripped = from c in value.ToCharArray()
Line 584 ⟶ 594:
test("CSharp Programming Language");
}
</syntaxhighlight>
{{out}}
<pre>Input: CSharp Programming Language
Line 590 ⟶ 600:
=={{header|C++}}==
<
#include <iostream>
Line 636 ⟶ 646:
test("C++ Programming Language");
return 0;
}</
{{out}}
<pre>Input : C++ Programming Language
Line 643 ⟶ 653:
=={{header|Common Lisp}}==
<
(and (characterp c) (characterp (find c vowels :test #'char-equal))))
(defun remove-vowels (s)
(and (stringp s) (remove-if #'vowel-p s)))</
=={{header|Cowgol}}==
<
include "strings.coh";
Line 680 ⟶ 690:
CopyString(str, &buf[0]); # make a copy of the string into writeable memory
Devowel(&buf[0]); # remove the vowels
print(&buf[0]); # print the result </
{{out}}
Line 687 ⟶ 697:
=={{header|D}}==
<
void print_no_vowels(string s) {
Line 704 ⟶ 714:
void main() {
print_no_vowels("D Programming Language");
}</
{{out}}
<pre>D Prgrmmng Lngg</pre>
Line 710 ⟶ 720:
=={{header|Delphi}}==
{{libheader| System.SysUtils}}
<syntaxhighlight lang="delphi">
program Remove_vowels_from_a_string;
Line 743 ⟶ 753:
end.
</syntaxhighlight>
{{out}}
Line 750 ⟶ 760:
After: Th qck brwn fx jmps vr th lzy dg
</pre>
=={{header|EasyLang}}==
<syntaxhighlight>
func$ rmv s$ .
for c$ in strchars s$
if strpos "AEIOUaeiou" c$ <> 0
c$ = ""
.
r$ &= c$
.
return r$
.
print rmv "The Quick Brown Fox Jumped Over the Lazy Dog's Back"
</syntaxhighlight>
=={{header|F_Sharp|F#}}==
<
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")
</syntaxhighlight>
{{out}}
<pre>
Line 762 ⟶ 786:
=={{header|Factor}}==
<
: without-vowels ( str -- new-str ) "aeiouAEIOU" without ;
"Factor Programming Language" dup without-vowels
" Input string: %s\nWithout vowels: %s\n" printf</
{{out}}
<pre>
Line 775 ⟶ 799:
=={{header|Forth}}==
<
: VALIDATE ( char addr len -- 0|n) ROT SCAN NIP ; \ find char in string
Line 791 ⟶ 815:
THEN
LOOP
PAD COUNT ;</
{{out}}
<pre>
Line 800 ⟶ 824:
=={{header|Fortran}}==
<
program remove_vowels
implicit none
Line 825 ⟶ 849:
end subroutine print_no_vowels
end program remove_vowels
</syntaxhighlight>
{{out}}
<pre>
Line 835 ⟶ 859:
=={{header|FreeBASIC}}==
<
", how many pickled peppers did Peter Piper pick?"
dim as string outstr = "", c
Line 849 ⟶ 873:
next i
print outstr</
=={{header|Free Pascal}}==
''See also [[#Pascal|Pascal]]''
{{libheader|strUtils}}
<
uses
strUtils;
Line 867 ⟶ 891:
end;
writeLn(line)
end.</
=={{header|Frink}}==
<syntaxhighlight lang="frink">s = """Rosetta Code is a programming chrestomathy site.
The idea is to present solutions to the same
task in as many different languages as possible,
to demonstrate how languages are similar and
different, and to aid a person with a grounding
in one approach to a problem in learning another."""
println[s =~ %s/[aeiou]//gi ]</syntaxhighlight>
{{out}}
<pre>
Rstt Cd s prgrmmng chrstmthy st.
Th d s t prsnt sltns t th sm
tsk n s mny 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.
</pre>
=={{header|Fōrmulæ}}==
{{FormulaeEntry|page=https://formulae.org/?script=examples/Remove_vowels_from_a_string}}
'''Solution'''
[[File:Fōrmulæ - Remove vowels from a string 01.png]]
[[File:Fōrmulæ - Remove vowels from a string 02.png]]
=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">window 1, @"Remove vowels from a string"
local fn StringByRemovingVowels( string as CFStringRef ) as CFStringRef
end fn = fn ArrayComponentsJoinedByString( fn StringComponentsSeparatedByCharactersInSet( string, fn CharacterSetWithCharactersInString( @"aeiou" ) ), @"" )
print fn StringByRemovingVowels( @"The quick brown fox jumps over the lazy dog." )
print fn StringByRemovingVowels( @"FutureBasic is a great programming language!" )
HandleEvents</syntaxhighlight>
{{out}}
<pre>
Th qck brwn fx jmps vr th lzy dg.
FtrBsc s grt prgrmmng lngg!
</pre>
=={{header|Go}}==
<
import (
Line 900 ⟶ 961:
fmt.Println("Input :", s)
fmt.Println("Output :", removeVowels(s))
}</
{{out}}
Line 912 ⟶ 973:
Removing three specific Anglo-Saxon vowels from a text, using a general method which can apply to any specific subset of glyphs.
<
exceptGlyphs :: String -> String -> String
Line 929 ⟶ 990:
main :: IO ()
main = putStrLn $ exceptGlyphs "eau" txt</
{{Out}}
Line 942 ⟶ 999:
diffrnt, nd to id prson with gronding
in on pproch to problm in lrning nothr.</pre>
=={{header|J}}==
<syntaxhighlight lang="j">devowel =: -. & 'aeiouAEIOU'</syntaxhighlight>
=={{header|Java}}==
You can use the ''String.replaceAll'' method, which takes a regular expression as it's first argument.
<syntaxhighlight lang="java">
"rosettacode.org".replaceAll("(?i)[aeiou]", "");
</syntaxhighlight>
<br />
Or
<syntaxhighlight lang="java">public static String removeVowelse(String str){
String re = "";
char c;
Line 953 ⟶ 1,019:
}
return re;
}</
=={{header|JavaScript}}==
Line 961 ⟶ 1,027:
( ''Pace'' Jamie Zawinski, some people, when confronted with a problem, think "I know, I'll use '''parser combinators'''." )
<
'use strict'
Line 1,224 ⟶ 1,290:
// main ---
return main();
})();</
{{Out}}
<pre> Rostt Cod is progrmming chrstomthy sit.
Line 1,236 ⟶ 1,302:
but a filter is all we need here:
<
'use strict';
Line 1,260 ⟶ 1,326:
// main ---
return main();
})();</
{{Out}}
<pre> Rostt Cod is progrmming chrstomthy sit.
Line 1,268 ⟶ 1,334:
diffrnt, nd to id prson with gronding
in on pproch to problm in lrning nothr.</pre>
=={{header|Joy}}==
<syntaxhighlight lang="joy">DEFINE unvowel == ["AaEeIiOoUu" in not] filter.
"Remove ALL vowels from this input!" unvowel putchars.</syntaxhighlight>
{{out}}
<pre>Rmv LL vwls frm ths npt!</pre>
=={{header|jq}}==
{{works with|jq}}
'''Works with gojq, the Go implementation of jq'''
<syntaxhighlight lang="sh">
#!/bin/bash
Line 1,306 ⟶ 1,379:
input | jq -Rr --arg v "$vowels" 'gsub("[\($v)]+"; ""; "i")'
</syntaxhighlight>
{{out}}
<pre>
Line 1,336 ⟶ 1,409:
=={{header|Julia}}==
Unicode sensitive, using the Raku version example text.
<
const ALLVOWELSY = Dict(ch => 1 for ch in Vector{Char}("AÀÁÂÃÄÅĀĂĄǺȀȂẠẢẤẦẨẪẬẮẰẲẴẶḀÆǼEȄȆḔḖḘḚḜẸẺẼẾỀỂỄỆĒĔĖĘĚÈÉÊËIȈȊḬḮỈỊĨĪĬĮİÌÍÎÏIJOŒØǾȌȎṌṎṐṒỌỎỐỒỔỖỘỚỜỞỠỢŌÒÓŎŐÔÕÖUŨŪŬŮŰŲÙÚÛÜȔȖṲṴṶṸṺỤỦỨỪỬỮỰYẙỲỴỶỸŶŸÝ"))
Line 1,353 ⟶ 1,426:
println("Removing vowels from:\n$testtext\n becomes:\n",
String(filter(!isvowel, Vector{Char}(testtext))))
</
<pre>
Removing vowels from:
Line 1,374 ⟶ 1,447:
dctn shll b fr, t lst n th lmntry nd fndmntl stgs.
</pre>
=={{header|K}}==
{{works with|ngn/k}}
<syntaxhighlight lang=K>novowel: {x^"aeiouAEIOU"}
novowel"The Quick Brown Fox Jumped Over the Lazy Dog's Back"
"Th Qck Brwn Fx Jmpd vr th Lzy Dg's Bck"
</syntaxhighlight>
=={{header|Kotlin}}==
<
val re = StringBuilder()
for (c in s) {
Line 1,392 ⟶ 1,473:
fun main() {
println(removeVowels("Kotlin Programming Language"))
}</
{{out}}
<pre>Ktln Prgrmmng Lngg</pre>
=={{header|Lambdatalk}}==
<syntaxhighlight lang="scheme">
'{S.replace [aeiouy]* by in
Rosetta Code is a programming chrestomathy site.
The idea is to present solutions to the same
task in as many different languages as possible,
to demonstrate how languages are similar and
different, and to aid a person with a grounding
in one approach to a problem in learning another.}
-> 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>
=={{header|Lua}}==
<
local outStr, letter = ""
local vowels = "AEIUOaeiou"
Line 1,412 ⟶ 1,506:
local testStr = "The quick brown fox jumps over the lazy dog"
print(removeVowels(testStr))</
{{out}}
<pre>Th qck brwn fx jmps vr th lzy dg</pre>
=={{header|Mathematica}}/{{header|Wolfram Language}}==
<
{{out}}
<pre>Th Qck Brwn Fx Jmpd Ovr th Lzy Dg's Bck</pre>
=={{header|MATLAB}} / {{header|Octave}}==
<syntaxhighlight lang="matlab">
function [result] = remove_vowels(text)
% http://rosettacode.org/wiki/Remove_vowels_from_a_string
Line 1,440 ⟶ 1,537:
%!test
%! assert(remove_vowels('The quick brown fox jumps over the lazy dog'),'Th qck brwn fx jmps vr th lzy dg')
</syntaxhighlight>
{{out}}
Line 1,449 ⟶ 1,546:
=={{header|Nim}}==
<
const Vowels = {'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'}
Line 1,464 ⟶ 1,561:
const TestString = "The quick brown fox jumps over the lazy dog"
echo TestString
echo TestString.dup(removeVowels(Vowels))</
{{out}}
<pre>The quick brown fox jumps over the lazy dog
Th qck brwn fx jmps vr th lzy dg</pre>
=={{header|OCaml}}==
<syntaxhighlight lang="ocaml">let remove_vowels s : string =
let not_vowel = Fun.negate (String.contains "AaEeIiOoUu") in
String.to_seq s |> Seq.filter not_vowel |> String.of_seq</syntaxhighlight>
=={{header|Pascal}}==
''See also [[#Delphi|Delphi]] or [[#Free Pascal|Free Pascal]]''<br/>
This program works with any ISO 7185 compliant compiler.
<
const
Line 1,547 ⟶ 1,649:
end;
writeLn
end.</
{{in}}
The quick brown fox jumps over the lazy dog.
Line 1,555 ⟶ 1,657:
{{works with|Extended Pascal}}
More convenient though is to use some Extended Pascal (ISO 10206) features:
<
const
vowels = ['A', 'E', 'I', 'O', 'U', 'a', 'e', 'i', 'o', 'u'];
Line 1,575 ⟶ 1,677:
writeLn(disemvoweledLine)
end.</
{{in}}
The quick brown fox jumps over the lazy dog.
Line 1,583 ⟶ 1,685:
=={{header|Perl}}==
Inspired by the Raku entry.
<
use warnings;
use utf8;
Line 1,602 ⟶ 1,704:
my @vowels;
chr($_) =~ /[aæeiıoœu]/i and push @vowels, chr($_) for 0x20 .. 0x1ff;
print NFD($_) =~ /@{[join '|', @vowels]}/ ? ' ' : $_ for split /(\X)/, $text;</
{{out}}
<pre>N rw g n, c l nd c, G rm n, T rk sh, Fr nch, Sp n sh, ngl sh:
Line 1,614 ⟶ 1,716:
=={{header|Phix}}==
<!--<
<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>
<!--</
{{out}}
<pre>
Line 1,624 ⟶ 1,726:
</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
<!--<
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
Line 1,649 ⟶ 1,751:
<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>
<!--</
(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}}==
<
println("The Quick Brown Fox Jumped Over the Lazy Dog's Back".remove_vowels),
println("Picat programming language".remove_vowels).
remove_vowels(S) = [C : C in S, not membchk(C,"AEIOUaeiou")].</
{{out}}
Line 1,668 ⟶ 1,770:
<syntaxhighlight lang="prolog">
:- system:set_prolog_flag(double_quotes,chars) .
Line 1,705 ⟶ 1,807:
lists:member(CHAR,"AEIOUaeiouüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜáíóúªºαΩ")
.
</syntaxhighlight>
{{out}}
Line 1,731 ⟶ 1,833:
{{works with|Python|3.7|}}
<
Line 1,766 ⟶ 1,868:
# MAIN ---
if __name__ == '__main__':
main()</
{{Out}}
<pre> Rostt Cod is progrmming chrstomthy sit.
Line 1,777 ⟶ 1,879:
===One liner===
Well, almost........
<syntaxhighlight lang="python">
txt = '''
Rosetta Code is a programming chrestomathy site.
Line 1,787 ⟶ 1,889:
print(''.join(list(filter(lambda a: a not in "aeiou",txt))))
</syntaxhighlight>
{{out}}
<pre>
Line 1,799 ⟶ 1,901:
=={{header|Quackery}}==
<
witheach
[ bit | ] ] constant is vowels ( --> f )
Line 1,810 ⟶ 1,912:
$ '"Beautiful coquettes are quacks of love."'
$ ' -- Francois De La Rochefoucauld' join
disemvowel echo$</
'''Output:'''
Line 1,828 ⟶ 1,930:
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.)
<syntaxhighlight lang="raku"
my $text = q:to/END/;
Line 1,841 ⟶ 1,943:
END
put $text.subst(/@vowels/, ' ', :g);</
{{out}}
<pre>N rw g n, c l nd c, G rm n, T rk sh, Fr nch, Sp n sh, ngl sh:
Line 1,857 ⟶ 1,959:
=== using the TRANSLATE BIF ===
This REXX version uses the '''translate''' BIF which works faster for longer strings as there is no character-by-character manipulation.
<
parse arg x /*obtain optional argument from the CL.*/
if x='' | x="," then x= 'REXX Programming Language' /*Not specified? Then use default*/
Line 1,867 ⟶ 1,969:
y= space(translate(y, , vowels), 0) /*trans. vowels──►blanks, elide 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. */</
{{out|output|text= when using the default input:}}
<pre>
Line 1,876 ⟶ 1,978:
=== using character eliding ===
This REXX version uses a character-by-character manipulation and should be easier to understand.
<
parse arg x /*obtain optional argument from the CL.*/
if x='' | x="," then x= 'REXX Programming Language' /*Not specified? Then use default*/
Line 1,890 ⟶ 1,992:
x= substr(x, 2) /*elide the prefixed dummy character. */
say 'output string: ' x /*stick a fork in it, we're all done. */</
{{out|output|text= is identical to the 1<sup>st</sup> REXX version.}} <br><br>
=={{header|Ring}}==
<
load "stdlib.ring"
str = "Ring Programming Language"
Line 1,904 ⟶ 2,006:
next
see "String without vowels: " + str + nl
</syntaxhighlight>
{{out}}
<pre>
Line 1,910 ⟶ 2,012:
String without vowels: Rng Prgrmmng Lngg
</pre>
=={{header|RPL}}==
≪ "AEIOUaeiou" → string vowels
≪ "" 1 string SIZE '''FOR''' j
string j DUP SUB
'''IF''' vowels OVER POS '''THEN''' DROP '''ELSE''' + '''END'''
'''NEXT'''
≫ ≫ ''''NOVWL'''' STO
{{in}}
<pre>
"This is a difficult sentence to pronounce" NOVWL
</pre>
{{out}}
<pre>
1: "Ths s dffclt sntnc t prnnc"
</pre>
=={{header|Ruby}}==
<
p "Remove vowels from a string".delete("aeiouAEIOU") # => "Rmv vwls frm strng"
</syntaxhighlight>
=={{header|Rust}}==
<
fn remove_vowels(str: String) -> String {
let vowels = "aeiouAEIOU";
Line 1,937 ⟶ 2,055:
println!("{}", remove_vowels(intro));
}
</syntaxhighlight>
Output :
<pre>
Line 1,943 ⟶ 2,061:
Frrs, th crb, s th nffcl msct f th Rst Prgrmmng Lngg
</pre>
=={{header|sed}}==
<syntaxhighlight lang="sed">s/[AaEeIiOoUu]//g</syntaxhighlight>
=={{header|Smalltalk}}==
<
out := in reject:[:ch | ch isVowel].
in printCR.
out printCR.</
{{out}}
<pre>The balloon above harsh harsh waters of programming languages, is the mascot of Smalltalk
Line 1,954 ⟶ 2,075:
As usual, there are many alternative ways to do this:
<
out := in select:[:ch | ch isVowel not].
Line 1,968 ⟶ 2,089:
ch isVowel ifFalse:[ s nextPut:ch ]
]]
</syntaxhighlight>
=={{header|Standard ML}}==
<
CharVector.exists (fn v => c = v) "AaEeIiOoUu"
Line 1,979 ⟶ 2,100:
val str = "LOREM IPSUM dolor sit amet\n"
val () = print str
val () = print (removeVowels str)</
{{out}}
<pre>LOREM IPSUM dolor sit amet
Line 1,985 ⟶ 2,106:
=={{header|Swift}}==
<
switch (char) {
case "a", "A", "e", "E", "i", "I", "o", "O", "u", "U":
Line 2,000 ⟶ 2,121:
let str = "The Swift Programming Language"
print(str)
print(removeVowels(string: str))</
{{out}}
Line 2,009 ⟶ 2,130:
=={{header|Visual Basic .NET}}==
<
Module Module1
Line 2,039 ⟶ 2,160:
End Sub
End Module</
{{out}}
<pre>Input : Visual Basic .NET
Output : Vsl Bsc .NT</pre>
=={{header|V (Vlang)}}==
{{trans|AutoHotkey}}
<syntaxhighlight lang="v (vlang)">fn main() {
mut str := 'The quick brown fox jumps over the lazy dog'
for val in 'aeiou'.split('') {str = str.replace(val,'')}
println(str)
}</syntaxhighlight>
{{out}}
<pre>
Th qck brwn fx jmps vr th lzy dg
</pre>
=={{header|Wren}}==
<
var s = "Wren Programming Language"
System.print("Input : %(s)")
System.print("Output : %(removeVowels.call(s))")</
{{out}}
Line 2,058 ⟶ 2,193:
=={{header|XBS}}==
<
set Vowels:array="aeiou"::split();
set nx:string="";
Line 2,072 ⟶ 2,207:
}
log(RemoveVowels("Hello, world!"));</
{{out}}
<pre>
Line 2,079 ⟶ 2,214:
=={{header|XPL0}}==
<
func Disemvowel(S); \remove vowels from string
Line 2,093 ⟶ 2,228:
];
Text(0, Disemvowel("pack my box with FIVE DOZEN LIQUOR JUGS!"))</
Output:
Line 2,101 ⟶ 2,236:
=={{header|XProfan}}==
<syntaxhighlight lang="xprofan">cls
Set("RegEx",1)
Var string e = "The quick brown fox jumps over the lazy dog"
Var string a = Translate$(e,"(?i)[aeiou]","")
MessageBox("Input : "+e+"\nOutput: "+a,"Remove vowels",1)
End</
{{out}}
<pre>
|