Skip to content

Commit

Permalink
improved output format
Browse files Browse the repository at this point in the history
  • Loading branch information
Emir Sarı committed Sep 8, 2019
1 parent f2cd82a commit 968410b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Sources/mccCore/MorseCodeConverter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public struct MorseCodeConverter {
let textWithoutFancyQuotes = textWithoutFancyDoubleQuotes.replaceSingleQuotes(textWithoutFancyDoubleQuotes, singleQuotesArray: singleQuotesArray)
let textWithoutFancyQuotesHyphensAndDashes = textWithoutFancyQuotes.replaceHyphensAndDashes(textWithoutFancyQuotes, hyphensAndDashesArray: hyphensAndDashesArray)

var morseText = "\n"
var morseText = ""
let characterArray = textWithoutFancyQuotesHyphensAndDashes.lowercased().map { String($0) }

for character in characterArray {
Expand All @@ -34,7 +34,7 @@ public struct MorseCodeConverter {
}
}
}
return morseText.isEmpty ? textToConvert : morseText + "\n"
return morseText.isEmpty ? textToConvert : morseText
}
}

Expand Down
3 changes: 1 addition & 2 deletions Sources/mccCore/Program.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ public struct Program {
if copy {
copyToClipboard(textToCopy: conversionResult)
}
print("\n\(textToConvert) in morse:")
return conversionResult
return "\n" + textToConvert + " in morse: " + conversionResult + "\n"
}

func copyToClipboard(textToCopy: String) {
Expand Down

0 comments on commit 968410b

Please sign in to comment.