| Bytes | Lang | Time | Link |
|---|---|---|---|
| 054 | Dyalog APL | 250930T054409Z | Aaron |
| 123 | AWK | 250929T172818Z | xrs |
| 065 | Jelly | 220914T183125Z | Baby_Boy |
| 056 | Vyxal U | 220609T031158Z | naffetS |
| 069 | Raku | 220908T211639Z | Sean |
| 075 | Japt v2.0a0 | 170529T114932Z | Shaggy |
| 099 | Python | 220609T063337Z | iOS 15.5 |
| 140 | Python 3 | 151012T034633Z | user4594 |
| 073 | 05AB1E | 160509T162959Z | user5340 |
| 073 | Retina | 151012T023114Z | NinjaBea |
| 600 | Sacred JavaScript ES6 | 151013T042141Z | Conor O& |
| 160 | Lua | 151029T021746Z | Veer Sin |
| 078 | Perl 6 | 151027T230600Z | Brad Gil |
| 063 | CJam | 151012T022155Z | Dennis |
| 058 | Pyth | 151012T043724Z | Dennis |
| 189 | Java | 151012T042505Z | GamrCorp |
| 097 | Sed | 151013T203704Z | R.. GitH |
| 125 | Scala | 151013T101323Z | user1010 |
| 116 | ><> | 151012T025153Z | cole |
| 084 | Perl 5 | 151012T072829Z | Dom Hast |
| 105 | Julia | 151012T143806Z | Glen O |
| 089 | Ruby | 151012T084232Z | golgappa |
| 126 | Julia | 151012T035636Z | Alex A. |
| 114 | Javascript ES6 | 151012T031831Z | DankMeme |
Dyalog APL, 54 bytes
{a('ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ'⌷⍨⊂⍤⍳)@((a←⎕C⎕A)∊⍨⊢)⊢⍵}
@ ⊢⍵ # Replace in the input
( ∊⍨⊢) # where the argument is a member of
(a←⎕C⎕A) # the lowercase (a)lphabet, saved for later
a( ) # with the result of this function, passing that lowercase alphabet on the left
⍳ # indices of the left arg in the right arg
⊂⍤ # atop enclose
⌷⍨ # selected from
'ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ' # that crazy new alphabet
💎
Created with the help of Luminespire.
AWK, 123 bytes
{for(;i++<split("ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ",a,X);)gsub(sprintf("%c",i+96),a[i])}1
Jelly, 65 bytes
“⁾ḋḷ?D8=ƙʂȤ£²^ĖẸI)¡e[µ°⁾ṢJ*MĠɓ¤Ḃġ⁽vEEɲạ®G{(ŀ³⁻¹ƭTẸⱮ’ṃ“ȥ3’Ọ
Øaż¢Fy
“⁾ḋḷ?D8=ƙʂȤ£²^ĖẸI)¡e[µ°⁾ṢJ*MĠɓ¤Ḃġ⁽vEEɲạ®G{(ŀ³⁻¹ƭTẸⱮ’ṃ“ȥ3’Ọ : Link 1
“⁾ḋḷ?D8=ƙʂȤ£²^ĖẸI)¡e[µ°⁾ṢJ*MĠɓ¤Ḃġ⁽vEEɲạ®G{(ŀ³⁻¹ƭTẸⱮ’ : Compressed integer for 454193002670633612531343815167055208136573147142298478503419521655224802790872780438775790455172058745698867697958481400
“ȥ3’ : Compressed integer for 42802
ṃ : Base decompression; convert x to base length(y) then index into y; results in character codes
Ọ : Cast to characters
Øaż¢Fy : Main Link
Øa : Lowercase alphabet
¢ : Last link as a nilad
ż : Zip; interleave x and y
F : Flatten list
y : Translate the elements of y according to the mapping in x; change the characters
Integers used to get the character codes borrowed from Steffan's Vyxal Answer
Vyxal U, 56 bytes
ka`#Ẏṗ'(*¥ṫ§Ẋ⟨ẎṫẊ₅-.Ẏẏ0Ẋ¦2;Ṫ₆Ẏ↓¥ṫε>?CDxẎḋE`C:70<7389*+CĿ
Port of CJam.
How?
ka`#Ẏṗ'(*¥ṫ§Ẋ⟨ẎṫẊ₅-.Ẏẏ0Ẋ¦2;Ṫ₆Ẏ↓¥ṫε>?CDxẎḋE`C:70<7389*+CĿ
ka # Push the lowercase alphabet
`#Ẏṗ'(*¥ṫ§Ẋ⟨ẎṫẊ₅-.Ẏẏ0Ẋ¦2;Ṫ₆Ẏ↓¥ṫε>?CDxẎḋE` # Push string "#ʙ'(*ꜰɢʜɪ-.ʟ0ɴ2;ǫʀꜱ>?CDxʏE"
C # Convert to character codes: [35, 665, 39, 40, 42, 42800, 610, 668, 618, 45, 46, 671, 48, 628, 50, 59, 491, 640, 42801, 62, 63, 67, 68, 120, 655, 69]
: # Duplicate
70< # For each, is it less than 70?
7389* # Multiply by 7389
+ # Add
C # Convert from character codes
Ŀ # Transliterate the implicit input from the lowercase alphabet to this
Previous answer:
Vyxal, 61 bytes
ka»7ȧ∵ẋǍ}Żq(ṗ⌐>⁋8≤M?↵:‡⌊&fǍ≈⁋D5£ɾ|øP₂@ġĿ≤ǔxτ¶_ṙɾ|ȧ.,=»»₃↲»τCĿ
How?
ka»7ȧ∵ẋǍ}Żq(ṗ⌐>⁋8≤M?↵:‡⌊&fǍ≈⁋D5£ɾ|øP₂@ġĿ≤ǔxτ¶_ṙɾ|ȧ.,=»»₃↲»τCĿ
ka # Push the lowercase alphabet
»7ȧ∵ẋǍ}Żq(ṗ⌐>⁋8≤M?↵:‡⌊&fǍ≈⁋D5£ɾ|øP₂@ġĿ≤ǔxτ¶_ṙɾ|ȧ.,=» # Push compressed integer 454193002670633612531343815167055208136573147142298478503419521655224802790872780438775790455172058745698867697958481400
»₃↲» # Push compressed integer 42802
τ # Convert the big integer to that custom base as a list: [7424, 665, 7428, 7429, 7431, 42800, 610, 668, 618, 7434, 7435, 671, 7437, 628, 7439, 7448, 491, 640, 42801, 7451, 7452, 7456, 7457, 120, 655, 7458]
C # Convert it from character codes to characters
Ŀ # Transliterate the implicit input from the lowercase alphabet to that
Raku, 69 bytes
{S:g[(q)|<[a..wyz]>]=$0??'ǫ'!!'ᴀ'.uniname.subst(/.$/,$/).uniparse}
Special handling for q; for other lowercase letters other than x, generate the Unicode name for the small caps (eg, LATIN LETTER SMALL CAPITAL S) and parse it.
I saved a few bytes by using the Unicode name of the character ᴀ (LATIN LETTER SMALL CAPITAL A) as a template, and replacing the final character with the letter I want to convert.
Japt v2.0a0, 81 80 78 75 bytes
r\aÈcg"ʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢᴀʙᴄᴅᴇꜰɢ
- Saved 2 bytes thank to ETHproductions
Python, 99 bytes
def s(t):return"".join([(a,"ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ"[(ord(a)+7)%26])[96<ord(a)<123] for a in t])
I tried to find some pattern in the Unicode codes for small capitals, but I'm not sure there is one.
Python 3, 140 bytes
import sys;print(sys.stdin.read().translate(dict(zip(range(97,123),'ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ'))))
Hooray for built-in Unicode support! Now works with multi-line input.
-10 bytes thanks to @Bakuriu
05AB1E, 73 bytes (non-competing)
Yet again, I wish Adnan had published this language earlier.
A"ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ"‡
Explanation:
A - Push a-z
"ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ" - Push "ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ"
‡ - Pop a, b, c Push a.transliterate(b -> c)
Retina, 73 bytes
T`a-z`ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ
This is exactly what Retina's transliterate mode was made for. It replaces all lowercase letters (a-z) with their corresponding small caps version. Annoyingly, the character codes of the small caps characters are all over the place, so it can't take advantage of ranges for the second part: ideally it would be T`a-z`ᴀ-ᴢ.
Sacred JavaScript ES6, 600 Bytes
Hey look, I answered!
( ))) ) )( ) ))( ))) () ((( (( ()((( ))( ) ( )() (((( () ) () ( () )( )(( ((() () ((( (( ()((( (( (((((((() ) )( ) ))(( )( ) )((( ) ( () )( )(( ) (( ) ( ()(((((( (((( ()() ) ((() ( () () (( )( ( )) (( (( (((( ()( ((() () ((( (( ()((( (( (((( (((((( () (())( ) ) ((() ) )( ) )) ( )((()))) ())() ( () ((() ) ( ()((()() ) )(()) ()( ()( () )()()(( () )(()(()())() ()()) ( ( ) ())))) ) (() ()(((( ) )() ) ( )(( ( (( ) )( (( ((()( ( ((((() () (( ) ( )()( ()((( ) )((((( ( ( ) (( ) ) )( )(( )) (((( ((() () ) ( ) (( (( ((()(((()((((() ((() () (( ))((( ( ( )) (( )( () ( ()
Here's a cool image:

JavaScript ES6, 120 Bytes
This is the code.
k=>k.match(/./g).map(z=>new Array(26) .fill(0).map((q,e)=>"ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ"[e])[z.charCodeAt()-97]||z).join``)
This is the snippet.
while(1)alert(prompt().match(/./g).map(z=>new Array(26) .fill(0).map((q,e)=>"ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ"[e])[z.charCodeAt()-97]||z).join``
Lua, 160 bytes
function c(a)
return a:lower():gsub("%w",function(d)b=a.byte(d)-96;return("ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ"):sub(b,b)end)end
Perl 6, 78 bytes
The simplest command line version:
$ perl6 -pe'tr/a..z/ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ/' # 76 + 2 = 78
It gets a bit larger if you put it into a file.
$_=$*IN.slurp-rest;tr/a..z/ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ/;.print # 102
CJam, 78 74 67 66 63 bytes
q'{,97>"#ʙ'(*ꜰɢʜɪ-.ʟ0ɴ2;ǫʀꜱ>?CDxʏE"{_'a<7389*+}%er
This uses the same idea as my other answer.
The code contains no unprintable characters. Try it online in the CJam interpreter.
How it works
q e# Read all input and push it on the stack.
'{, e# Push the range of all characters up to 'z'.
97> e# Remove the first 97 characters. This leaves lowercase letters.
"#ʙ'(*ꜰɢʜɪ-.ʟ0ɴ2;ǫʀꜱ>?CDxʏE"
{ e# Map; for each character in that string:
_'a< e# Check if a copy of the character is lower than 'F'. Pushes 1 or 0.
7389* e# Multiply the resulting Boolean by 7389.
+ e# Add the product to the character's code point.
}% e#
er e# Perform transliteration; replace each letter in the input by the
e# corresponding character of the modified string.
Pyth, 61 59 58 bytes
LXbGsmC+*7389<dGCd"#ʙ'(*ꜰɢʜɪ-.ʟ0ɴ2;ǫʀꜱ>?CDxʏE
This defines a named function y. Try it online in the Pyth Compiler/Executor.
The code contains no unprintable characters.
Idea
Among the small caps, there are 14 characters in the range 7424 – 7458, and all of them require three bytes to be stored verbatim. By subtracting 7389 from their code points, we map them in the printable ASCII range 35 – 69, so each of them will occupy only one byte.
To decode the string, we simply add 7389 to the code points of all characters that come before a.
Code
L Define y(b):
Xb Transliterate b...
G by replacing the lowercase ASCII letters...
with the characters of result of the following:
m "… Map; for each d in that string:
*7389<dG Calculate (7389 * (d < 'abc...xyz')).
+ Cd Add the product to int(d).
C Cast to character.
s Turn the resulting char array into a string.
Java, 306 275 217 215 189 bytes
Well, Java is definetely not the best language to accomplish this task in... but, here it is anyway:
void p(String s){for(int i=1;i<27;s=s.replace("abcdefghijklmnopqrstuvwxyz".charAt(++i),"ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ".charAt(i)));System.out.print(s);
Thanks to @ThomasKwa and @DHall for help in shaving off 91 characters!
Sed, 97 bytes
y/abcdefghijklmnopqrstuvwxyz/ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ/
Scala, 125 bytes
(s:String)=>s.map(c=>('a'to'z'zip "ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ"toMap).getOrElse(c,c))
An anonymous function that has string as an input and output. Iterate through its chars and get the unicode version of them by matching them from dict/map. Return original char if the unicode one doesn't exist.
Usage
- Open Scala REPL and paste the code above
- It will create a function (
resX) that can be called by passing a string (e.g.resX("my String"))
><>, 118 116 Bytes
-2 bytes thanks to @torcado.
I'll try to think of a way to remove that entire alphabet from my code later.
I haven't been able to test it with newlines, but I see no reason for it not working with them.
!oi:0(?;::"{"($"`")*0$.
v"a"%&"ᴢʏxᴡᴠᴜᴛꜱʀǫᴘᴏɴᴍʟᴋᴊɪʜɢꜰᴇᴅᴄʙᴀ"&
>:?!v1-$~
~00.>
Try it online.
Emoticons found in the code: 0:(, :0, :"{, >:, 0=, and the debatable ones: i:, >:?, :?, ?;
Perl 5, 84 bytes
(83 bytes script and -p)
use utf8;y/a-z/ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ/
Nothing particularly different, but it's worth noting the necessity of the use utf8; statement to get legible text. A warning is displayed as well, but I believe the consensus is that they are acceptable:
$perl -p smallcaps.pl <<< 'Programming Puzzles and Code Golf'
Wide character in print, <> line 1.
Pʀᴏɢʀᴀᴍᴍɪɴɢ Pᴜᴢᴢʟᴇꜱ ᴀɴᴅ Cᴏᴅᴇ Gᴏʟꜰ
$perl -p smallcaps.pl <<< 'Programming Puzzles and Code Golf' 2> /dev/null
Pʀᴏɢʀᴀᴍᴍɪɴɢ Pᴜᴢᴢʟᴇꜱ ᴀɴᴅ Cᴏᴅᴇ Gᴏʟꜰ
Perl, 80 bytes
(74 bytes script and -pMutf8)
Thanks @hobbs!
y/a-z/ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ/
$perl -pMutf8 -e'y/a-z/ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ/' <<< 'Programming Puzzles and Code Golf' 2> /dev/null
Pʀᴏɢʀᴀᴍᴍɪɴɢ Pᴜᴢᴢʟᴇꜱ ᴀɴᴅ Cᴏᴅᴇ Gᴏʟꜰ
Julia, 105 bytes
t->map(c->96<c<123?["ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ"...][c-'`']:c,t)
This is simple - for each character in t, it checks to see if the character, c, is lowercase (96<c<123) - if it is, it subtracts the character with value 96 ('`') from the character, and looks up the corresponding character in the array [ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ"...]. If it's not lowercase, then just use c itself. The map function applies this procedure for each character in the string.
Alternative, if we can restrict input to ASCII less than 127:
Julia, 104 bytes
t->join(['\1':'`';"ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ{|}~"...][t.data])
In this case, the array is longer, including all characters between ASCII 1 ('\1') and 126 ('~'), with the lowercase letters replaced as appropriate - it then uses the characters in t, expressed as unsigned integers (t.data), to lookup the values in the array, and joins the new characters back into a string at the end.
Ruby, 89 bytes
p ARGV[0].tr "a-z","ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ"
To use:
ruby <file-name> "<string>"
Julia, 126 bytes
t->join([(i=Int(c);96<i<123?split("ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ","")[i-96]:c)for c=t])
Ungolfed:
function f(t::AbstractString)
# Split the small caps into an array (this particular Unicode
# string does not like to be indexed for whatever reason)
s = split("ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ", "")
# Create an array with replaced letters
r = [(i = Int(c); 96 < i < 123 ? s[i-96] : c) for c in t]
# Join the array back into a string
join(r)
end
Javascript (ES6), 114 bytes
a=>a.replace(/[a-z]/g,b=>'ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ'[b.charCodeAt()-97])
// snippet
var o = document.getElementById("o");
var t = document.getElementById("t");
t.onkeyup = _=>o.textContent = (a=>a.replace(/[a-z]/g,b=>'ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ'[b.charCodeAt()-97]))(t.value);
<!-- snippet -->
<input id="t" placeholder='Sample Text' />
<pre id="o"></pre>