Skip to content

Commit

Permalink
Resolved the string export issue in Swift 5.
Browse files Browse the repository at this point in the history
  • Loading branch information
vigneshuvi authored and Vignesh Kumar committed Mar 11, 2020
1 parent 8e1f5bf commit 47a2c1e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Examples/MacOS/SampleMacSwift/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ target 'SampleMacSwift' do
pod 'SwiftLoggly’
# pod 'SwiftCSVExport'
pod 'SwiftCSVExport', :git => 'https://github.com/vigneshuvi/SwiftCSVExport.git', :tag => '2.1.0'
pod 'SwiftCSVExport', :git => 'https://github.com/vigneshuvi/SwiftCSVExport.git', :tag => '2.3.0'
# Pods for SampleMacSwift
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Supported swift 4, 4.2 and 5 and latest Xcode

pod 'SwiftCSVExport' , '= 2.0.2' // Swift 4
pod 'SwiftCSVExport' , '= 2.0.3' // Swift 4.2
pod 'SwiftCSVExport' , '= 2.2.0' // Swift 5
pod 'SwiftCSVExport' , '= 2.3.0' // Swift 5


```
Expand Down
7 changes: 4 additions & 3 deletions Sources/CSVConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,11 @@ extension String {
func formatCSVRow(_ div:String, value:Any) -> String {
if let string = value as? String {
// Wrap around double quotes
let fString = "\(string)"
return self.length == 0 ? fString : "\(self)\(div)\(fString)"
let doubleQuotes = "'"
let fString = doubleQuotes+"\(string)"+doubleQuotes
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
8 changes: 5 additions & 3 deletions SwiftCSVExport/Sources/CSVConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,12 @@ extension String {
func formatCSVRow(_ div:String, value:Any) -> String {
if let string = value as? String {
// Wrap around double quotes
let fString = "\(string)"
return self.length == 0 ? fString : "\(self)\(div)\(fString)"
let doubleQuotes = "'"

let fString = doubleQuotes+"\(string)"+doubleQuotes
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

0 comments on commit 47a2c1e

Please sign in to comment.