home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Plugins
MyTorrents
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="fcsobel" data-source="post: 109139" data-attributes="member: 16823"><p>I put up a new version that should get around the embedded commas.</p><p></p><p><a href="http://projects.c3o.com/MediaPortal/plugins.zip" target="_blank">http://projects.c3o.com/MediaPortal/plugins.zip</a></p><p></p><p>For those who care the problem is that JSON data is comma delimited but there may be commas within strings like this:</p><p></p><p>"Language, Sex, Violence, Other"</p><p></p><p>Regular expressions are the civilized way to get around this problem but they make my head hurt so I found an example here:</p><p></p><p><a href="http://www.4guysfromrolla.com/webtech/120400-1.3.shtml" target="_blank">http://www.4guysfromrolla.com/webtech/120400-1.3.shtml</a></p><p></p><p>Which helped me write this code to replaces the commas outside of quotes with '\b' which is then used to delimit the columns.</p><p></p><p>string commapat = ",(?=([^\\\"]*\\\"[^\\\"]*\\\")*(?![^\\\"]*\\\"))";</p><p>Regex reg = new Regex(commapat);</p><p>RowString = reg.Replace(RowString, "\b");</p></blockquote><p></p>
[QUOTE="fcsobel, post: 109139, member: 16823"] I put up a new version that should get around the embedded commas. [url]http://projects.c3o.com/MediaPortal/plugins.zip[/url] For those who care the problem is that JSON data is comma delimited but there may be commas within strings like this: "Language, Sex, Violence, Other" Regular expressions are the civilized way to get around this problem but they make my head hurt so I found an example here: [url]http://www.4guysfromrolla.com/webtech/120400-1.3.shtml[/url] Which helped me write this code to replaces the commas outside of quotes with '\b' which is then used to delimit the columns. string commapat = ",(?=([^\\\"]*\\\"[^\\\"]*\\\")*(?![^\\\"]*\\\"))"; Regex reg = new Regex(commapat); RowString = reg.Replace(RowString, "\b"); [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
MyTorrents
Contact us
RSS
Top
Bottom