From df70f22400eb0a746fe221429e8a239407e3348e Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Tue, 4 Oct 2022 20:03:20 +0100 Subject: - Added guest contribution by Robert DiCicco. --- challenge-185/robert-dicicco/julia/ch-2.jl | 41 ++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 challenge-185/robert-dicicco/julia/ch-2.jl diff --git a/challenge-185/robert-dicicco/julia/ch-2.jl b/challenge-185/robert-dicicco/julia/ch-2.jl new file mode 100644 index 0000000000..2898c9fe94 --- /dev/null +++ b/challenge-185/robert-dicicco/julia/ch-2.jl @@ -0,0 +1,41 @@ +#!/usr/bin/env julia + +# AUTHOR: Robert DiCicco +# DATE: 2022-10-04 +# Challenge 185 Mask Code ( Julia ) + +inp = ["ab-cde-123", "123.abc.420", "3abc-0010.xy", "1234567.a", "a-1234-bc", "a.b.c.d.e.f"] + +for i in inp + + cnt = 1; # where we are in the string + + fnd = 0; # count of characters changed + + while fnd < 4 + + sp = SubString(i,cnt,cnt) + + if ((sp == ".") || (sp == "-")) + + cnt += 1 + + continue + + end + + i_arr = split(i,"") + + i_arr[cnt] = "x" + + i = join(i_arr) + + fnd += 1 + + cnt += 1 + + end + + println(i) + +end -- cgit