Sha256: 43d05d57fdfa79cc971a512c51e1d96956143bfe5dfa82007a9242196899de01

Contents?: true

Size: 492 Bytes

Versions: 141

Compression:

Stored size: 492 Bytes

Contents

function rotate(n::Int, c::Char)
    if c in 'a':'z'
        c = 'a' + (c - 'a' + n) % 26
    elseif c in 'A':'Z'
        c = 'A' + (c - 'A' + n) % 26
    end
    return c
end

rotate(n::Int, s::String) = join(rotate(n, c) for c in s)

for n in 0:26
    # current_module() is necessary due to constraints of runtests.jl
    # This is not required for the user solving the exercise
    eval(current_module(), :(macro $(Symbol(:R, n, :_str))(s::String)
        :(rotate($$n, $s))
    end))
end

Version data entries

141 entries across 141 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/julia/exercises/rotational-cipher/example.jl
trackler-2.2.1.179 tracks/julia/exercises/rotational-cipher/example.jl
trackler-2.2.1.178 tracks/julia/exercises/rotational-cipher/example.jl
trackler-2.2.1.177 tracks/julia/exercises/rotational-cipher/example.jl
trackler-2.2.1.176 tracks/julia/exercises/rotational-cipher/example.jl
trackler-2.2.1.175 tracks/julia/exercises/rotational-cipher/example.jl
trackler-2.2.1.174 tracks/julia/exercises/rotational-cipher/example.jl
trackler-2.2.1.173 tracks/julia/exercises/rotational-cipher/example.jl
trackler-2.2.1.172 tracks/julia/exercises/rotational-cipher/example.jl
trackler-2.2.1.171 tracks/julia/exercises/rotational-cipher/example.jl
trackler-2.2.1.170 tracks/julia/exercises/rotational-cipher/example.jl
trackler-2.2.1.169 tracks/julia/exercises/rotational-cipher/example.jl
trackler-2.2.1.167 tracks/julia/exercises/rotational-cipher/example.jl
trackler-2.2.1.166 tracks/julia/exercises/rotational-cipher/example.jl
trackler-2.2.1.165 tracks/julia/exercises/rotational-cipher/example.jl
trackler-2.2.1.164 tracks/julia/exercises/rotational-cipher/example.jl
trackler-2.2.1.163 tracks/julia/exercises/rotational-cipher/example.jl
trackler-2.2.1.162 tracks/julia/exercises/rotational-cipher/example.jl
trackler-2.2.1.161 tracks/julia/exercises/rotational-cipher/example.jl
trackler-2.2.1.160 tracks/julia/exercises/rotational-cipher/example.jl