Jump to content

Search the Community

Showing results for tags 'backslash'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


There are no results to display.


  • Welcome to Smart Mobile Studio
    • News and Information
    • Pre-Sales Questions
    • Smart In the Media
    • Smart Contests
    • Meta
  • Smart Mobile Studio Discussion
    • General
    • IDE
    • RTL
    • Code
    • Client Server
    • Platform
    • Graphics
    • Deployment
    • Suggestion box
  • Smart Mobile Studio support
    • Support
    • Bug report
  • General Discussion
    • Pascal
    • Delphi
    • Javascript
    • HTML/HTML5
    • CSS
  • Resources
    • Website
    • Download Smart Mobile Studio

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL



Company name


Found 1 result

  1. lynkfs


    5 lines of code which drove me bonkers. My brilliant idea was to have a set of classes, where class A has a field which is an array of class B, and class B has a field which is an array of class C etc - and then just stringify the whole setup and store that string in a MySQL database. That would save me from setting up multilayered tables and I could just compress everything in a single base table. JB = record field1 : string; params : Array of JC; end; JA= record fields : array of JB; end; stringifying this (asm @textdata = JSON.stringify(@data); where @data refers to JA) gives what I was after. Except that all fieldnames in the result-string have a '$1' appended ({"field1$1"). No idea why that happens or how to avoid that. Pushing on, using a while-loop with 'pos' and 'delete' to get rid of this suffix doesn't work. The Pos and Delete functions don't work on strings resulting from an asm @string operation. Next best thing : string replace with regex. In the end I needed to do something like this : asm @textdata = JSON.stringify(@data); var r = new RegExp('\\$1', 'g'); //delete all name-postfixes of '$1' @res = (@textdata).replace(r, ""); var r2 = new RegExp('\\"', 'g'); //add backslashes just before double quotes @res2 = (@res).replace(r2, '\\"'); //and add mysql backslash character as well end; The first replacement operation gets rid of all the $1 suffixes The second replacement operation sets a \ around text pieces which either have a special character or space in their content, like : font-family: \"Old Standard TT\" And to make matters worse, found out that MySQL just ignores all backslashes in update statements. Unless these backslashes are preceded with a special character. (In this case another backslash). Haven't mentioned some other caveats like handling EOL characters Anyway, got it working, but it might have been easier to set up multi-layer tables after all. If anyone has a solution for the automatic suffix addition ($1) in stringify operations please let me know.