g | x | w | all
Bytes Lang Time Link
057AWK241216T164047Zxrs
019Pyth241214T213700ZErikDaPa
012Kakoune241214T030104ZJoshM
013Uiua241213T190916ZJoao-3
381jBasher2240924T165918Zmadeforl
013UiuaSBCS240927T135117ZEurope20
014Uiua240925T122747Znyxbird
045PHP240622T115334ZGlory2Uk
140YASEPL240212T194232Zmadeforl
6359JS 63 .. 59 Bytes240304T085512ZAdam Bas
9459Scala 3231225T091523Z138 Aspe
009Pip240302T012643ZDLosc
088Swift231231T195053ZmacOSist
014Uiua SBCS240212T060119Zchunes
045R231231T200142ZGiuseppe
045APLNARS231225T184731ZRosario
125Swift231225T161414ZAnnett S
036Gema231225T033148Zmanatwor
4375Vyxal s230506T125201Zlyxal
005Vyxal 3 s231225T002434Zpacman25
064Lua230507T134157Zbluswimm
008Thunno 2 J230506T131651ZThe Thon
043Arturo230505T185756Zchunes
039Zsh extendedglob221107T172101Zroblogic
068Python 3220305T093319ZSapherey
007Vyxal220222T192154ZSeggan
075Excel VBA220216T165756ZEngineer
009Brachylog220216T112455ZFatalize
019Vim220216T185629ZDLosc
111Lexurgy220216T155321Zbigyihsu
017APL Dyalog Unicode220216T130900ZRGS
020Pyth220216T124715ZWallbrea
057Funky2220216T102129ZATaco
065SML200523T231537ZVibius
082Python 3200523T231153ZAdam Aba
049Julia200523T221245Zjling
021K oK200509T192824Zmkst
024K4200509T193634Zmkst
050Python 3200401T011848ZBubbler
070Python 3200324T054122Zyetanoth
9377JavaScript V8200325T084247Zsportzpi
068Haskell200325T150123Zdavid
053Python200325T003534Zxnor
084Python 3200324T143100ZDion
097Javascript V8200324T125820ZAesahaet
055Python 3200322T160611ZSurculos
048TSQL200323T194931ZBradC
019Perl 5 p200322T164406ZXcali
023Bash + Core utilities200322T205733ZMitchell
033Ruby200322T172351ZG B
00605AB1E200322T163617ZGrimmy
049C gcc200322T194007ZArnauld
115Batch200323T104133ZT3RR0R
021x8664 machine code200323T080001ZPeter Co
034Java 8200323T081930ZKevin Cr
045JavaScript Node.js200322T173150ZArnauld
046x86 platformindependent machine code200322T175258ZKamila S
082Red200322T192341ZGalen Iv
009W d200323T022148Zuser9206
072Io200323T011933Zuser9206
024sed200322T175950ZNoodle9
058C gcc200322T163744ZS.S. Ann
071C gcc200322T163417ZNoodle9
014Charcoal200322T175802ZNeil
009Retina200322T175405ZNeil
014APL Dyalog Extended200322T174702ZAdá
015CJam200322T171644ZLuis Men
00605AB1E200322T170810ZJonathan
007Japt v2.0a0200322T164206ZShaggy
007Jelly200322T163218ZJonathan

AWK, 96 57 bytes

{for(;i++<NF;)printf$i~/[aeiou]/?toupper($i):tolower($i)}

Attempt This Online!

{a["a"]="A";a["e"]="E";a["i"]="I";a["o"]="O";a["u"]="U"
$0=tolower($0);for(i in a)gsub(i,a[i])}1

Pyth, 19 bytes

sm?}d"aeiou"rd1drz0

Try this online!

sm?}d"aeiou"rd1drz0
                rz0 => .lower()
  ?}d"aeiou"        => if it's a vowel
            rd1     => capitalize it
               d    => else keep it as it is
 m                  => do it to every letter
s                   => list to str  

Kakoune, 24 17 12 bytes

%`s[aeiou]<ret>~

OLD:

%s[aeiouAEIOU]<ret>~%s<c-p><a-b><a-b>^<ret>`

ignore trailing space (how do I escape a backtick at the end of a markdown code block?)

Uiua, 13 bytes(SBCS)

⍥¯¬⊸∊"AEIOU"⌵

Try it in the pad!

Apparently, every other Uiua solution overlooks the fact that ⍥ repeat can be used pervasively, in other words, it implicitly does ≡ rows.

jBasher2, 437 381 bytes

turns out there were a few things that weren't needed.

create a with type string
ask for input
turn that into lowercase
set that to a
create l with type number
get length of a
set that to l
create i with type number
set 0 to i
create t with type string
while i < l
get item from a at i
set that to t
get location of t inside "aeiou
if that >= 0
turn t into uppercase
set that to t
endif
output inline t
add i by 1
set that to i
endwhile

UiuaSBCS, 13 bytes

×-1∈"AEIOU".⌵

Try it here!

Happy birthday to Uiua!

Explanation

              | desc       | stack
×-1∈"AEIOU".⌵ |            | "Hello, World!"
            ⌵ | uppercase  | "HELLO, WORLD!"
           .  | duplicate  | "HELLO, WORLD!" "HELLO, WORLD!"
   ∈"AEIOU"   | is vowel?  | "HELLO, WORLD!" [0 1 0 0 1 0 0 0 1 0 0 0 0]
 -1           | subtract 1 | "HELLO, WORLD!" [¯1 0 ¯1 ¯1 0 ¯1 ¯1 ¯1 0 ¯1 ¯1 ¯1 ¯1]
×             | multiply   | "hEllO, wOrld!"

Uiua, 14 bytes

¯⍜▽¯∈"AEIOU".⌵

Try it!

¯⍜▽¯∈"AEIOU".⌵
              ⌵ # uppercase
 ⍜▽ ∈"AEIOU".   # under keeping the vowels
    ¯           # lowercase
¯               # flip case

PHP, 45 bytes

fn($s)=>strtr(strtolower($s),"aeiou","AEIOU")

Attempt This Online!

Similar to the other answers here: conversion to lowercase, then the replacement of the vowels aeiou with their capitalized version.

YASEPL, 155 147 145 140 bytes

=f=2)"aeiouAEIOU"=1'=i=l®1`1=k=f=m¥i,1`9!y¥f,2!m}7,y,8!k$`8!+}2,10,9=j`2!j+!q$j»}7,m,2`3!j}1,90,5}2,65,5!$j+32|6`5!$j`6!k[7!-32`7!›!i+}2,l

JS 63 .. 59 Bytes

Hello this is how you can create it in JS using one line of code.

Code:

f=s=>s.toLowerCase().replace(/[aeiou]/g,v=>v.toUpperCase())

Test Cases:

  1. Basic Test Cases:

    • Input: "Hello"
      • Expected Output: "hEllO"
    • Input: "Stack Exchange"
      • Expected Output: "stAck ExchAngE"
    • Input: "abcdefghijklmnopqrstuvwxyz"
      • Expected Output: "AbcdEfghIjklmnOpqrstUvwxyz"
  2. Edge Cases:

    • Input: "" (Empty string)
      • Expected Output: "" (Empty string)
    • Input: "12345" (No vowels)
      • Expected Output: "12345"
    • Input: "AEIOU" (All vowels)
      • Expected Output: "AEIOU" (All uppercase)
  3. Case Insensitivity Test:

    • Input: "HeLLoWorLD"
      • Expected Output: "hEllOwOrLD"
  4. Special Characters Test:

    • Input: "@#$%"
      • Expected Output: "@#$%" (No vowels, no change expected)
    • Input: "hello$world"
      • Expected Output: "hEllO$wOrld" (Vowels in the middle of the string)
  5. Long String Test:

    • Input: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
      • Expected Output: "lOrEm IpsUm dOlOr sIt AmEt, cOnsEc tEtUr AdIpIscIng ElIt. sEd dO EIUsmOd tEmpOr IncIdIdUnt Ut lAbOrE Et dOlOrE MAgnA AlIqUA."
  6. Performance Test:

    • Input: "a" repeated 10^6 times (a million times)
      • Expected Output: "A" repeated 10^6 times
    • Input: "abcdefghijklmnopqrstuvwxyz" repeated 10^4 times
      • Expected Output: "AbcdEfghIjklmnOpqrstUvwxyz" repeated 10^4 times
  7. Random Test Cases:

    • Input: "hElLo!"
      • Expected Output: "hEllO!" (Only 'e' should be capitalized)
    • Input: "HeLlO 123"
      • Expected Output: "hEllO 123" (Only vowels should be capitalized)
    • Input: "rAnDoMT3XT"
      • Expected Output: "rAndOmt3xt" (Only 'a' and 'o' should be capitalized)

Try it Online:

f=s=>s.toLowerCase().replace(/[aeiou]/g,v=>v.toUpperCase())

// Test Cases
function runTest(input, expectedOutput) {
    const output = f(input);
    console.log("Input:", input);
    console.log("Expected Output:", expectedOutput);
    console.log("Actual Output:", output);
    if (output === expectedOutput) {
        console.log("Test Passed!");
    } else {
        console.log("Test Failed!");
    }
    console.log("-------------------------");
}

// Basic Test Cases
runTest("Hello", "hEllO");
runTest("abcdefghijklmnopqrstuvwxyz", "AbcdEfghIjklmnOpqrstUvwxyz");

// Edge Cases
runTest("", "");
runTest("12345", "12345");
runTest("AEIOU", "AEIOU");

// Case Insensitivity Test
runTest("HeLLoWorLD", "hEllOwOrld");

// Special Characters Test
runTest("@#$%", "@#$%");
runTest("hello$world", "hEllO$wOrld");

// Long String Test
runTest("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", "lOrEm IpsUm dOlOr sIt AmEt, cOnsEctEtUr AdIpIscIng ElIt. sEd dO EIUsmOd tEmpOr IncIdIdUnt Ut lAbOrE Et dOlOrE mAgnA AlIqUA.");

// Performance Test
runTest("a".repeat(1e6), "A".repeat(1e6));
runTest("abcdefghijklmnopqrstuvwxyz".repeat(1e4), "AbcdEfghIjklmnOpqrstUvwxyz".repeat(1e4));

// Random Test Cases
runTest("hElLo!", "hEllO!");
runTest("HeLlO 123", "hEllO 123");
runTest("rAnDoMT3XT", "rAndOmt3xt");

Scala 3, 94 59 bytes

59 bytes(Saved 35 bytes thanks to @movatica). Attempt This Online!

_.toLowerCase.map(c=>if("aeiou"contains c)c.toUpper else c)

94 bytes. Attempt This Online!

_.toLowerCase.map{case'a'=>'A';case'e'=>'E';case'i'=>'I';case'o'=>'O';case'u'=>'U';case c=>c}

Pip, 9 bytes

LCaRXVUC_

Attempt This Online!

Explanation

LCaRXVUC_
LCa        ; Lowercase the input string
   R       ; Replace
    XV     ;  any lowercase vowel
      UC_  ;  with itself uppercased

Swift, 95 88 bytes

let c={($0+"").map{"aeiouAEIOU".contains($0) ?$0.uppercased():$0.lowercased()}.joined()}

Uiua SBCS, 14 bytes

¯⍜▽¯∊,"AEIOU"⌵

Try it!

0.9.0 recently extended abs and negate to work on characters, making this much easier.

¯⍜▽¯∊,"AEIOU"⌵
             ⌵  # uppercase the input
    ∊,"AEIOU"   # mask of vowels
 ⍜▽¯            # swap case at indices given by the mask
¯               # swap case

R, 45 bytes

function(s)chartr('aeiou','AEIOU',tolower(s))

Try it online!

APL(NARS), 45 chars

{⍵∊⎕A∼'AEIOU':⎕a[⎕A⍸⍵]⋄⍵∊'aeiou':⎕A[⎕a⍸⍵]⋄⍵}¨

test & how to use:

      f←{⍵∊⎕A∼'AEIOU':⎕a[⎕A⍸⍵]⋄⍵∊'aeiou':⎕A[⎕a⍸⍵]⋄⍵}¨
      f 'Hello World' 
hEllO wOrld

Swift, 125 bytes

Short version:

func c(_ t:String)->String{return t.lowercased().map({String($0)}).map({"aeiou".contains($0) ?$0.uppercased():$0}).joined()}

Verbose version:

func c2 (_ t: String) -> String {
    let s = t.map({String($0).lowercased()})
    let lv = ["a", "e", "i", "o", "u"]

    let r = s.map { l in
        lv.contains(l) ? l.uppercased() : l
    }.joined()
    
    return r
}

Gema, 36 characters

/[aeiou]/=@upcase{$0}
?=@downcase{?}

Sample run:

bash-5.2$ gema '/[aeiou]/=@upcase{$0};?=@downcase{?}' <<< 'Hello World'
hEllO wOrld

Try it online!

Vyxal s, 35 bitsv2, 4.375 bytes

⇩ƛAß⇧

Try it Online!

Bitstring:

11010011100001101111110111101101010

minus 6 bits thanks to pacmanboss256

Posted as a separate answer because a) vyncode isn't a golfing suggestion and b) it's different enough to be its own answer - it's not a byte shave from the other answer.

Explained (old)

ƛA[⇧|⇩
ƛ       # To each character:
 A[     #   if it is a vowel:
   ⇧    #     uppercase
    |   #   else:
     ⇩  #     lowercase

Vyxal 3 s, 5 bytes

ʀƛA¿ɾ

Try it Online!

lowercase the entire string then uppercase the vowels

Lua, 64 bytes

print(((...):lower():gsub('[aeiou]',load'return(...):upper()')))

Try it online!

Thunno 2 J, 8 bytes

ıDṃh?R:L

Explanation

ıDṃh?R:L  # Implicit input
ı         # Map over each character
 D        # Duplicate the current character
  ṃh?     # If it's a vowel:
     R    #  Uppercase it
      :   # Otherwise:
       L  #  Lowercase it
          # Implicit output, joined into a string

Arturo, 43 bytes

$=>[replace lower&split"aeiou"split"AEIOU"]

Try it

Zsh --extendedglob, 39

<<<${${(L)@}//(#m)[aeiou]/${(U)MATCH/}}

Try it Online

Code borrowed from the Zsh Manual, Globbing Flags

Python 3, 68 bytes

lambda s:''.join([p.upper()if p in'aeiou'else p for p in s.lower()])

Try it online!

Vyxal, 7 bytes

ɽƛAß⇧;ṅ

Try it Online!

ɽƛAß⇧;ṅ # Takes the string as input
ɽ       # Lowercase the string
 ƛ   ;  # Map the characters in the string to...
  A     # Is character a vowel?
   ß⇧   # If truthy, uppercase the letter
      ṅ # Join by nothing

Excel VBA, 78 75 bytes

Saved 3 bytes thanks to Taylor Raine because of course

t=LCase([A1]):For Each c in Split("A E I O U"):t=Replace(t,c,c,,,1):Next:?t

Code is run in the immediate window and uses the cell A1 from the active sheet as it's input. The method is simple:

Screenshot

Brachylog, 10 9 bytes

ḷ{∈Ṿ&ụ|}ᵐ

Try it online!

-1 byte thanks to @DLosc.

Explanation

ḷ             Lowercase the whole input
 {      }ᵐ    Map on each char of the input:
  ∈Ṿ             The char lowercased is in "aeiou"
     &ụ          Output the char uppercased
       |         Or do nothing

Vim, 19 bytes

Vu:s/[aeiou]/\U&/g

Try it online!

Explanation

Vu

Select the current line and lowercase it.

:s/

In the current line, replace...

[aeiou]/

a vowel character with...

\U&/

the uppercase version of itself...

g<nl>

for every match on the line.

Lexurgy, 111 bytes

Simple replacement

a:
{a,e,i,o,u,B,C,D,F,G,H,J,K,L,M,N,P,Q,R,S,T,V,W,X,Y,Z}=>{A,E,I,O,U,b,c,d,f,g,h,j,k,l,m,n,p,q,r,s,t,v,w,x,y,z}

APL (Dyalog Unicode), 17 bytes SBCS

1⎕C@(∊∘'aeiou')⎕C

Try it on APLgolf!

A tacit function that ports @Adam's Dyalog Extended solution into vanilla Dyalog APL. Makes use of the system function ⎕C introduced in Dyalog 18.0 (hence, won't work in TIO).

1⎕C@(∊∘'aeiou')⎕C    ⍝ Tacit function.
               ⎕C    ⍝ Convert to lowercase. Then:
1⎕C                  ⍝ Convert to uppercase
   @                 ⍝ at the positions
    (∊∘'aeiou')      ⍝ that are part of the vowels.

Pyth, 20 bytes

K"aeiou"smrd}d+KrK1w

Try it online!

Explanation

                       w=input()
K"aeiou"               K="aeiou"
        s              "".join(
         m              map(
          r              lambda d:r(
           d              d,
             d             d
            }             in
               K           K
              +            +
                 rK1       K.upper())),
                    w    w)

Funky2, 57 bytes

s=>s:gsub("."c=>ifc:match"[aeiou]"c:upper()elsec:lower())

Relatively simple solution, benefits from Funky2's relatively concise language.

Attempt This Online!

SML 65 bytes

Try it!

map(fn c=>if contains"AEIOUaeiou"c then toUpper c else toLower c)

This requires open String and open Char. If those are not allowed, then it would be 87 bytes (String.map Char.contains Char.toUpper Char.toLower).

Python 3, 82 bytes

f=lambda c:c.upper()if c in 'aeiou'else c.lower();lambda s:''.join(map(f,list(s)))

Julia 49 bytes

Try it!

f=l->map(c->in(c,"aeiou") ? c-32 : c,lowercase.(l))

K (oK), 27 23 21 bytes

Solution:

`c$x-32*~^"aeiou"?x:_

Try it online!

Explanation:

Even nicer approach thanks to @ngn... either substract 0 or 32 from the input based on whether or not it's a vowel:

`c$x-32*~^"aeiou"?x:_ / the solution
                    _ / lowercase input
                  x:  / store as 'x'
          "aeiou"?    / lookup input in "aeiou" else null
         ^            / is null?
        ~             / not
    -32*              / multiply boolean list by -32 (yields 0 or -32)
   x                  / subtract from x
`c$                   / cast back to characters

Notes:

K4, 24 bytes

Solution:

.q.ssr/[;_v;v:"AEIOU"]@_

Explanation:

Replace each lowercase vowel with the uppercase equivalent.

.q.ssr/[;_v;v:"AEIOU"]@_ / the solution
                       _ / lowercase
                      @  / apply
.q.ssr/[;  ;         ]   / search/replace, iterate over vowels
            v:"AEIOU"    / store uppercase vowels as 'v'
         _v              / lowercase vowels

Python 3, 50 bytes

lambda s:bytes(c^(c^~68174912>>c%32)&32for c in s)

Try it online!

Port of Arnauld's JS answer using bytes object in Python. Because Python's >> does not imply %32 on its right argument, it must be done manually.

Python 3, 70 bytes

lambda s:''.join(l.upper()if l in'aeiouAEIOU'else l.lower()for l in s)

Try it online!

JavaScript (V8), 93...77 bytes

Log:

s=>[...s].map(c=>/[aeiou]/i.test(c)?c.toUpperCase():c.toLowerCase()).join('')

Try it online!

s=> // es6 arrow function
    [...s]. // split input string into array
        map(c => // another es6 arrow function, this time for a callback iterating over the array
             /[aeiou]/i // case insensitive regex
                .test(c)? // use a ternary operator to check if the character matches the regex
                    c.toUpperCase(): // if true return character to uppercase
                        c.toLowerCase()) // otherwise return lowercase
                            .join('') // join the array back into a string

Methods mentioned:

Haskell, 68 bytes

import Data.Char
f=map(g.toLower)
g x|x`elem`"aeiou"=toUpper x|1<2=x

Try it online!

Python, 53 bytes

lambda s:[(c*2).title().strip('aeiou')[-1]for c in s]

Try it online!

Outputs a list of characters.

Here is an explanation of how it transforms each character c, with examples c='A' and c='B':

                'A'  'B'
(c*2)           'AA' 'BB'  # Two copies of c in a two-character string
.title()        'Aa' 'Bb'  # Title case: uppercase first letter and the rest lowercase
                           # This disregards the case of c
.strip("aeiou") 'A'  'Bb'  # Remove any leading or trailing lowercase vowels 'aeiou'
                           # For a two-character string, this removes all such letters
[-1]            'A'  'b'   # Take the last letter

55 bytes

lambda s:[(c*2).title()[~(c in'aieouAEIOU')]for c in s]

Try it online!

If we were instead lowercasing vowels and uppercasing consonants, we wouldn't need the ~() and would have 52 bytes.

Python 3, 85 84 bytes

x=''
for i in input():
 if i in'aAeEiIoOuU':x+=i.upper()
 else:x+=i.lower()
print(x)

Try it online!

Pretty new to codegolf, so probably not the shortest solution

edit 1: one byte saved because of a space

Javascript (V8), 97 bytes

s=>[...s].map(c=>{t="aeiouAEIOU";return(t.includes(c)?c.toUpperCase():c.toLowerCase())}).join('')

Takes a string, iterate over every chars and check if the char is a vowel. If so return the char in uppercase, otherwise in lowercase. Then join the return of the map with a void char.

Python 3, 55 bytes

lambda s:[[c,c.upper()][c in"aeiou"]for c in s.lower()]

Try it online!

Input: A string/sequence of characters
Output: a list of characters.

Explanation

The solution converts the string to lower case, then convert all vowels to uppercase.

T-SQL, 48 bytes

SELECT TRANSLATE(LOWER(v),'aeiou','AEIOU')FROM t

Takes input from a pre-existing table t with varchar column v, per our IO rules.

Converts the entire string to lowercase, then makes just the vowels uppercase. The function TRANSLATE works in SQL 2017 and later.

Perl 5 -p, 20 19 bytes

-1 due to @NahuelFouilleul

$_=lc;y;aeiou;AEIOU

Try it online!

Convert everything to lower case, then change vowels to upper case.

Bash + Core utilities, 25 23 bytes

tr aeiou AEIOU<<<${1,,}

Try it online!

Saved 2 bytes thanks to a suggestion of Nahuel Fouilleul.

Input is passed as an argument, output is on stdout.

Ruby, 33 bytes

->s{s.downcase.tr"aeiou","AEIOU"}

Straightforward solution: downcase everything, then upcase vowels.

Try it online!

05AB1E, 8 7 6 bytes

-1 byte thanks to Kevin Cruijssen

lžODu‡

Try it online!

C (gcc), 49 bytes

Port of my JS answer.

f(char*s){for(;*s;s++)*s^=(*s^~68174912>>*s)&32;}

Try it online!


C (clang), 48 bytes

A version suggested by @Neil

This is abusing the way clang is dealing with the pointer post-increment.

f(char*s){for(;*s;)*s++^=(*s^~68174912>>*s)&32;}

Try it online!

Batch, 118 115 Bytes

3 bytes saved thanks to Neil

@Set o=%*
@For %%A in (A E I O U b c d f g h j k l m n p q r s t v w x y z)do @Call Set o=%%o:%%A=%%A%%
@ECHO(%O%

Explanation:

Uses Call Set to update variable during operation of For Loop in conjunction with Substring Modification: VarName=%VarName:ToSub=SubValue%.

Substring modification is not case-sensitive - case is determined using the defined For loop set %%A in (set)

No TIO Available

x86-64 machine code, 21 bytes

(Or 20 bytes for an x86-32 version with an explicit length input, allowing dec/jnz as the loop condition. Using cl for a shift count makes it not a win to use loop, and 64-bit mode has 2-byte dec so it's break-even to make it explicit-length).

Callable as void vucd_implicit(char *rdi) with the x86-64 System V calling convention. (It leaves RDI pointing to the terminating 0 byte if you want to use that bonus return value.)

# disassembly: objdump -drwC -Mintel
0000000000401000 <theloop>:
  401000:       b8 a0 bb ef fb          mov    eax,0xfbefbba0
  401005:       d3 e8                   shr    eax,cl
  401007:       30 c8                   xor    al,cl
  401009:       24 20                   and    al,0x20
  40100b:       30 c8                   xor    al,cl
  40100d:       aa                      stos   BYTE PTR es:[rdi],al
000000000040100e <vowel_up_consonant_down>:        # the function entry point
  40100e:       8a 0f                   mov    cl,BYTE PTR [rdi]
  401010:       84 c9                   test   cl,cl
  401012:       75 ec                   jne    401000 <theloop>
  401014:       c3                      ret    

Notice that the function entry point is in the middle of the loop. This is something you can do in real life; as far as other tools are concerned, theloop is another function that falls into this one as a tailcall.

This uses something like Arnauld's xor/and/xor idea for applying the lcase bit to an input character, instead of the more obvious and cl, ~0x20 to clear it in the original, and al, 0x20 to isolate it from the mask, and or al, cl to combine. That would be 1 byte larger because and cl, imm8 can't use the AL,imm special encoding with no ModRM.

Having the bitmap left-shifted by 5 so the bit we want lines up with 0x20 is also due to @Arnauld's answer. I had been planning to use bt/salc like in a previous vowel/consonant bitmap answer and mask that with 0x20 until I tried Arnauld's way and found it could be done even more efficiently.

NASM source (Try it online! with a test caller that does strlen on a command line arg and uses a write() system call afterward)

global vowel_up_consonant_down
theloop:
                                             ; consonant bitmap
    ;          ZYXWVUTSRQPONMLKJIHGFEDCBA@    For indexing with ASCII c&31 directly
    mov   eax, 111110111110111110111011101b << 5   ; line up with the lcase bit
                                             ; the low bit is 1 to preserve 0x20 ' '
    shr   eax, cl               ; AL & 0x20 is how the lowercase bit *should* be set
    xor   al, cl                ; bitdiff = (mask>>c) & c
    and   al, 0x20              ; isolate the lowercase bit
    xor   al, cl                ; flip the lcase bit if needed
    stosb                       ; and store
vowel_up_consonant_down:
    mov   cl, [rdi]
    test  cl, cl
    jnz  theloop               ; }while(c != 0)
    ret

Variants

no spaces: 19 bytes

If we didn't need to handle spaces (ASCII 0x20), we enter the function at the top, with the mov cl, [rdi] load at the top, but still leave the loop condition at the bottom. So we'd load and re-store the terminating 0, and the XOR that produced it would set ZF. The low bit of the bitmap would be 0 instead of 1.

vucd_pure_alphabetic:
.loop:
    mov   cl, [rdi]
   ...               ; same, but with bitmap[0] => 0
    xor   al,cl
    jnz  .loop       ; mask>>0 leave the terminating 0 unmodified; xor sets ZF

Upper-case-only input, like the A to Z in the question indicates: 19 bytes

(Or 17 without spaces either.)

If we can assume the lower-case bit was already cleared on input ASCII bytes, we can save one XOR (and change the other one to an OR)

    ...
    shr   eax, cl
    and   al, 0x20
    or    al, cl
    ...

Using the bt instruction:

Normally testing a bitmap is a job for the bt instruction, but where we're not branching on the result, it turns out to be cheaper to shift it, even though that means we can't easily use the loop instruction. (I haven't gone back to this idea to re-golf it after realizing we need to handle spaces).

I suspect there's room for more golfing, but the first version of this I tried was

vucd:
.loop:
    mov   dl, [rdi]
    ;          ZYXWVUTSRQPONMLKJIHGFEDCBA@    1-indexed using ASCII codes directly
    mov   esi, 111110111110111110111011101b   ; consonant/vowel bitmap for use with bt
    bt    esi, edx              ; CF = mask & (1U << (c&31))
%if CPUMODE == 32
    salc                        ; 1B   only sets AL = 0 or 0xFF.  Not available in 64-bit mode
%else
    sbb   eax, eax              ; 2B   eax = 0 or -1, according to CF.
%endif
    xor   al, dl
    and   al, 0x20              ; just the lowercase bit
    xor   al, dl
    loop .loop
    ret

Not re-tested after tweaking to handle spaces.

bt + salc in 32-bit mode costs the same as shr reg,cl + the extra test cl,cl that's needed because we can't use loop. So I think this is also 21 bytes. But 32-bit mode explicit-length can just dec/jnz a reg other than cl for a 20-byte total.

mov esi, imm32 can be hoisted out of the loop, or we can use EAX. Neither affects byte count, only efficiency or the calling-convention.

Java 8, 86 34 bytes

S->S.map(c->c^(c^~68174912>>c)&32)

-52 bytes by porting @Arnauld's JavaScript answer, so make sure to upvote him!!

Original 86 bytes answer:

s->{s=s.toLowerCase();for(var p:"aeiou".toCharArray())s=s.replace(p,p&=~32);return s;}

Try it online.

Explanation:

s->{                               // Method with String as both parameter and return-type
  s=s.toLowerCase();               //  Convert the entire String to lowercase
  for(var p:"aeiou".toCharArray()) //  Loop over the vowels as characters:
    s=s.replace(p,p&=~32);         //   And replace the lowercase vowels to uppercase ones
  return s;}                       //  Then return the modified String as result

JavaScript (Node.js),  55 ... 46  45 bytes

Saved 1 byte thanks to @KevinCruijssen

s=>Buffer(s).map(c=>c^(c^~68174912>>c)&32)+''

Try it online!

How?

The constant \$68174912\$ is a bitmask describing the positions of the vowels:

00000100000100000100010001000000
     v     v     v   v   v
zyxwvutsrqponmlkjihgfedcba`_^]\[

As per the ECMAScript specification, the following expression:

~68174912 >> c & 32

is equivalent to:

~68174912 >> (c % 32) & 32

and therefore evaluates to \$32\$ for a consonant or \$0\$ for a vowel, no matter the case of \$c\$.

Commented

s =>                   // s = input string
  Buffer(s)            // turn s into a buffer
  .map(c =>            // for each ASCII code c:
    c ^                //   change the case if:
      ( c              //     c is not in lower case
        ^              //     XOR
        ~68174912 >> c //     c is a consonant
      ) & 32           //
  ) + ''               // end of map(); coerce back to a string

x86 platform-independent machine code, 46 bytes.

Expects the string pointer to be passed in eax, trashes ebx and edx. Entry point is located at 0x26.

Hex dump:

BA 22 82 20 00 D3 EA F6 C2 01 74 0B 8D
51 9F 83 FA 19 8D 59 E0 EB 09 8D 51 BF
83 FA 19 8D 59 20 0F 46 CB 88 08 40 0F
BE 08 85 C9 75 D3 C3

Disassembly:

00000000  BA22822000        mov edx,0x208222
00000005  D3EA              shr edx,cl
00000007  F6C201            test dl,0x1
0000000A  740B              jz 0x17
0000000C  8D519F            lea edx,[ecx-0x61]
0000000F  83FA19            cmp edx,byte +0x19
00000012  8D59E0            lea ebx,[ecx-0x20]
00000015  EB09              jmp short 0x20
00000017  8D51BF            lea edx,[ecx-0x41]
0000001A  83FA19            cmp edx,byte +0x19
0000001D  8D5920            lea ebx,[ecx+0x20]
00000020  0F46CB            cmovna ecx,ebx
00000023  8808              mov [eax],cl
00000025  40                inc eax
00000026  0FBE08            movsx ecx,byte [eax]
00000029  85C9              test ecx,ecx
0000002B  75D3              jnz 0x0
0000002D  C3                ret

byte count = 0x2E = 46

Red, 83 82 bytes

func[s][v: charset"aoeiu"parse lowercase s[any[to v change t: v(uppercase t/1)]]s]

Try it online!

W d, 9 bytes

→d╧o╧╪0╨←

Uncompressed:

("aeiou":)Z

Explanation

(           % Convert to lowercase
 "aeiou"    % All vowel strings
        :   % Duplicate
         )  % Convert to uppercase
          Z % Transliterate

Io, 72 bytes

Takes input as a special format.

method(x,x map(i,if("aeiou"containsSeq(i),i asUppercase,i asLowercase)))

Try it online!

sed, 41 25 24 bytes

Saved 16 bytes thanks to Surculose Sputum!!!
Saved a byte thanks to S.S. Anne!!!

s/./\L&/g
y/aeiou/AEIOU/

Try it online!

C (gcc), 58 \$\cdots\$ 58 bytes

f(char*s){for(;*s;)*s++=index("aeiou",*s|32)?*s&95:*s|32;}

I tried to find a pattern in the vowels' representations using the modulo operator but nothing short enough. Instead, use strchr.

Fixed a bug kindly pointed out by Noodle9 at the cost of 3 bytes.
-1 byte thanks to Noodle9!
-1 byte thanks to Surculose Sputum!
-1 byte thanks to ceilingcat!

Try it online!

C (gcc), 75 \$\cdots\$72 71 bytes

Added 4 bytes to fixed a bug.
Saved a byte thanks to ceilingcat!!!

u;f(char*s){for(;*s;*s++=u-65&&u-69&&u-73&&u-79&&u-85?*s|32:u)u=*s&95;}

Try it online!

Charcoal, 14 bytes

⭆↧S⎇№aeiouι↥ιι

Try it online! Link is to verbose version of code. Explanation:

  S             Input string
 ↧              Lowercased
⭆               Map over characters and join
     aeiou      Literal string `aeiou`
    №           Count occurrences of
          ι     Current character
   ⎇            If non-zero
            ι   Current character
           ↥    Uppercased
             ι  Else current character
                Implicitly print

Retina, 9 bytes

T`vVL`VVl

Try it online! Explanation:

T`v`V

Lowercase vowels get uppercased.

T`V`V

Uppercase vowels also get uppercased, to avoid being matched later.

T`L`l

All other uppercase letters get lowercased.

APL (Dyalog Extended), 14 bytesSBCS

Anonymous tacit prefix function.

⌈@(∊∘'aeiou')⌊

Try it online!

 lowercase

⌈@() uppercase at the following positions:

∊∘'aeiou' members of "aeiou"

CJam, 15 bytes

lel"aeiou"_euer

Try it online!

Explanation

l         e# Read line
el        e# To lowercase
"aeiou"   e# Push this string
_         e# Duplicate
eu        e# To uppercase
er        e# Transliterate. Implicitly display

05AB1E,  9  6 bytes

Saved 3 using Luis Mendo's CJam approach

lžMDu‡

Try it online! (Footer formats the resulting list of characters as a plain string)

How?

lžMDu‡         e.g. input="LowEr"  stack: []
l      - push lower-case (input)          ["lower"]
 žM    - push lower-case vowels           ["aeiou", "lower"]
   D   - duplicate                        ["aeiou", "aeiou", "lower"]
    u  - upper-case                       ["AEIOU", "aeiou", "lower"]
     ‡ - transliterate                    ["lOwEr"]
       - implicit print                   lOwEr

Japt v2.0a0 -m, 10 7 bytes

u r\c_v

Try it

Jelly,  9  7 bytes

Saved 2 using a variation of Luis Mendo's CJam approach

ØCŒHyŒu

A monadic Link accepting a list of characters which yields a list of characters.

Try it online!

How?

ØCŒHyŒu - Link: list of characters, S   e.g. "I am OK!"
ØC      - consonants                         "BCDF...XYZbcdf...xyz"
  ŒH    - split into two                     ["BCDF...XYZ", "bcdf...xyz"]
     Œu - convert (S) to upper-case          "I AM OK!"
    y   - translate                          "I Am Ok!"