aboutsummaryrefslogtreecommitdiff
path: root/challenge-002
diff options
context:
space:
mode:
authorPaulo Custodio <pauloscustodio@gmail.com>2021-02-14 00:39:36 +0000
committerPaulo Custodio <pauloscustodio@gmail.com>2021-02-14 00:39:36 +0000
commite8a1190ebd8743bf718f9f83321acd9c83f14691 (patch)
tree8e47b13204e04db56bdd0266d501bc6a0362af78 /challenge-002
parent49857b9ef8e4b2981187a818f820a53c815350a4 (diff)
downloadperlweeklychallenge-club-e8a1190ebd8743bf718f9f83321acd9c83f14691.tar.gz
perlweeklychallenge-club-e8a1190ebd8743bf718f9f83321acd9c83f14691.tar.bz2
perlweeklychallenge-club-e8a1190ebd8743bf718f9f83321acd9c83f14691.zip
Remove tabs
Diffstat (limited to 'challenge-002')
-rw-r--r--challenge-002/paulo-custodio/awk/ch-2.awk14
1 files changed, 7 insertions, 7 deletions
diff --git a/challenge-002/paulo-custodio/awk/ch-2.awk b/challenge-002/paulo-custodio/awk/ch-2.awk
index c2af383106..67b75f5c8d 100644
--- a/challenge-002/paulo-custodio/awk/ch-2.awk
+++ b/challenge-002/paulo-custodio/awk/ch-2.awk
@@ -15,18 +15,18 @@ function format_number(n, base, negative, output, d) {
else {
negative = 0
}
-
+
output = ""
do {
d = n % base
n = int(n / base)
output = substr(digits, d+1, 1) output
} while (n > 0)
-
+
if (negative)
output = "-" output
-
- return output
+
+ return output
}
function scan_number(str, base, n, negative, ch, d) {
@@ -35,7 +35,7 @@ function scan_number(str, base, n, negative, ch, d) {
negative = 1
else
negative = 0
-
+
while (str != "") {
ch = toupper(substr(str, 1, 1))
str = substr(str, 2)
@@ -47,14 +47,14 @@ function scan_number(str, base, n, negative, ch, d) {
n = base * n + d
}
if (negative)
- n = -n
+ n = -n
return n
}
BEGIN {
BASE = 35
digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-
+
if (ARGV[1] == "-r")
print scan_number(ARGV[2], 35)
else