Skip to content

Commit

Permalink
Resolved issues 27 & 21
Browse files Browse the repository at this point in the history
  • Loading branch information
vigneshuvi committed Feb 5, 2021
1 parent 257631b commit a7258f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions SwiftCSVExport/Sources/CSVConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,13 @@ extension String {
if let string = value as? String {
// Wrap around double quotes
let doubleQuotes = "'"

let fString = doubleQuotes+"\(string)"+doubleQuotes
return self.length == 0 ? fString : "\(self)\(div) \(string)"
var fString = doubleQuotes+"\(string)"+doubleQuotes
if (self.count == 0) {
fString = string
}
return self.length == 0 ? fString : "\(self)\(div)\(string)"
} else {
return self.length == 0 ? "\(value)" : "\(self)\(div) \(value)"
return self.length == 0 ? "\(value)" : "\(self)\(div)\(value)"
}
}

Expand Down
6 changes: 3 additions & 3 deletions SwiftCSVExport/Sources/CSVExport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ import Foundation
let value = valuesArray[i];

if let lessPrecisePI = Float(value) {
rowsDictionary.setObject(lessPrecisePI, forKey: key as NSCopying);
rowsDictionary.setValue(lessPrecisePI, forKey: key);
} else if let morePrecisePI = Double(value) {
rowsDictionary.setObject(morePrecisePI, forKey: key as NSCopying);
rowsDictionary.setValue(morePrecisePI, forKey: key);
} else {
rowsDictionary.setObject(value, forKey: key as NSCopying);
rowsDictionary.setValue(value, forKey: key);
}
}
return rowsDictionary;
Expand Down

0 comments on commit a7258f9

Please sign in to comment.