Jump to content

Brace expansion using ranges: Difference between revisions

m
→‎{{header|Julia}}: add trigraph handling workaround
m (→‎{{header|Julia}}: add trigraph handling workaround)
Line 1,017:
 
=={{header|Julia}}==
Julia currently does not handle certain trigraphs in strings correctly, such as 🌶, so that test is omitted.
<lang julia>padzeros(str) = (len = length(str)) > 1 && str[1] == '0' ? len : 0
 
function ranged(str)
rang = filter(!isempty, split(str[2:end-1], r"\{|\}|\.\."))
delta = length(rang) > 2 ? parse(Int, rang[3]) : 1
if delta < 0
Line 1,066 ⟶ 1,065:
 
simpleAlphaDescending-{Z..X}.txt->
simpleAlphaDescending-Char[]Z.txt
simpleAlphaDescending-Char[]Y.txt
simpleAlphaDescending-Char[]X.txt
 
steppedDownAndPadded-{10..00..5}.txt->
Line 1,081 ⟶ 1,080:
 
combined-{Q..P}{2..1}.txt->
combined-Char[]Q2.txt
combined-Char[]Q1.txt
combined-Char[]P2.txt
combined-Char[]P1.txt
 
emoji{�..�}{�..�}etc->
emojiChar[]�Char[]�etc
emojiChar[]�Char[]�etc
emojiChar[]�Char[]�etc
emojiChar[]�Char[]�etc
 
li{teral->
Line 1,099 ⟶ 1,104:
 
steppedAlphaRising{P..Z..2}.txt->
steppedAlphaRisingPsteppedAlphaRisingChar[]P.txt
steppedAlphaRisingRsteppedAlphaRisingChar[]R.txt
steppedAlphaRisingTsteppedAlphaRisingChar[]T.txt
steppedAlphaRisingVsteppedAlphaRisingChar[]V.txt
steppedAlphaRisingXsteppedAlphaRisingChar[]X.txt
steppedAlphaRisingZsteppedAlphaRisingChar[]Z.txt
 
stops after endpoint-{02..10..3}.txt->
4,105

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.