- Timestamp:
- May 4, 2011, 9:53:40 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/services/dbnp/studycapturing/AssayService.groovy
r1790 r1803 523 523 524 524 outputStream << rowData.collect { row -> 525 row.collect{ it ? "\"$it\"" : '""' }.join(',') 525 row.collect{ 526 527 // omit quotes in case of numeric values 528 if (it instanceof Number) return it 529 530 def s = it.toString() 531 532 def addQuotes = false 533 534 // escape double quotes with double quotes if they exist and 535 // enable surround with quotes 536 if (s.contains('"')) { 537 addQuotes = true 538 s = s.replaceAll('"','""') 539 } else { 540 // enable surround with quotes in case of comma's 541 if (s.contains(',') || s.contains('\n')) addQuotes = true 542 } 543 544 addQuotes ? "\"$s\"" : s 545 546 }.join(',') 526 547 }.join('\n') 527 548
Note: See TracChangeset
for help on using the changeset viewer.