diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-10-04 20:03:20 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-10-04 20:03:20 +0100 |
| commit | df70f22400eb0a746fe221429e8a239407e3348e (patch) | |
| tree | 4e02755536a2e9869ca53915bf155cd3ebc85506 | |
| parent | 77916daf06a9a0e89bacc43edf34e10099301b02 (diff) | |
| download | perlweeklychallenge-club-df70f22400eb0a746fe221429e8a239407e3348e.tar.gz perlweeklychallenge-club-df70f22400eb0a746fe221429e8a239407e3348e.tar.bz2 perlweeklychallenge-club-df70f22400eb0a746fe221429e8a239407e3348e.zip | |
- Added guest contribution by Robert DiCicco.
| -rw-r--r-- | challenge-185/robert-dicicco/julia/ch-2.jl | 41 |
1 files changed, 41 insertions, 0 deletions
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 |
