Remove vowels from a string

From Rosetta Code
Revision as of 09:23, 25 July 2020 by rosettacode>Gerard Schildberger (→‎{{header|REXX}}: added the computer programming language REXX.)
Remove vowels from a string is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

Remove vowels from a string

REXX

<lang rexx>/*REXX program removes vowels (both lowercase and uppercase) from a string. */ parse arg x /*obtain optional argument from the CL.*/ if x= | x="," then x= 'REXX Programming Language' /*Not specified? Then use default*/ say ' input string: ' x $= translate( xrange(), ., ' ') /*define a string of almost all chars. */ q= substr($, verify($, x), 1) /*find a character NOT in the X string.*/ y= translate(x, q, " ") /*trans. blanks in the string (for now)*/ y= space(translate(y, , 'AEIOUaeiou'), 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. */</lang>

output   when using the default input:
 input string:  REXX Programming Language
output string:  RXX Prgrmmng Lngg

Ring

<lang ring> load "stdlib.ring" str = "Ring Programming Language" see "Input : " + str + nl for n = 1 to len(str)

   if isVowel(str[n])
      str = substr(str,str[n],"")
   ok

next see "String without vowels: " + str + nl </lang>

Output:
Input : Ring Programming Language
String without vowels: Rng Prgrmmng Lngg