regex - How do I escape a single quote using C# string.Replace to use in HighCharts? -


in c# application using user input fill elements in highcharts. issue running when user types customer's causes application break unless escaped typing \ before '.

here section in highcharts filling in user input:

subtitle: {     text: '<%=strdescription%>' }, 

when adding records, instead of telling users type \ before typing ' want them automatically them when pull out of database , assign variable. here have tried:

strdescription = reader1.getstring(0); strdescription.replace("'", "\'"); 

when remove slash user input causes application break if string not escaped. note following error:

subtitle: {     text: 'this goal set once have bench-marked first quarter's results.' }, 

how escape single quote properly?

one way invert quotes - '' ""

subtitle: {     text: "<%=strdescription%>" }, 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -