Skip to content
This repository has been archived by the owner on Jul 25, 2021. It is now read-only.

Escape cell if there's a comma #158

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

harryadel
Copy link

Table cells that contains commas are usually ignored if not causing misalignment, so we check if the text string contains a comma to escape it.

((val.textContent.indexOf(',') > -1) ? '"\'' : '"') + settings.formatValue(val.textContent.replace(/"/g, '""')) + '"';

The ES6 version of this solution is

`"'${settings.formatValue(val.textContent.replace(/"/g, '""'))}"`;

But we opted for the ES5 one for backwards compatibility, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant