Utility to convert Smart Quotes into normal ones

Discussion in 'iOS Code Snippets' started by Derek Johnson, Jun 26, 2015.

  1. Derek Johnson

    Derek Johnson Active Member Licensed User

    If you are converting Apps written for B4A V2.00 that have used Smart Quotes into B4I V1.80 applications you may have had to downgrade your Smart Quotes to use the plain old quote system.

    For example, in B4A Version 2.00 you might have:

    Code:
    Result=$"<tr>
    <td  valign=top><B><A href='info:${
    rec.County}:${rec.Libname}'>${rec.Libname}</a></B><BR>(${rec.Distance} ml ${rec.Direction})</td>
    <td>
    ${
    rec.street}<BR>
    ${
    rec.locality}<BR>
    ${
    rec.town}<BR>
    ${
    rec.County}<BR>
    <A href='geo:0,0?q=${
    rec.Libname}%20${rec.postcode}'>${rec.postcode}<BR><BR>
    <A href='Tel:${
    rec.Phone}'>${rec.Phone}</a>
    <UL>
            "$
    Changing this is quite a slow error-prone process, so I have written an Excel VBA application to automate this process:

    This is the output for the example above:

    Code:
    Dim SQ1 as StringBuilder
    SQ1.Initialize
    SQ1.Append(
    "<tr>" & CRLF)
    SQ1.Append(
    "<td  valign=top><B><A href='info:" & rec.County & ":" & rec.Libname & "'>" & rec.Libname & "</a></B><BR>(" & rec.Distance & " ml " & rec.Direction & ")</td>" & CRLF)
    SQ1.Append(
    "<td>" & CRLF)
    SQ1.Append(
    "" & rec.street & "<BR>" & CRLF)
    SQ1.Append(
    "" & rec.locality & "<BR>" & CRLF)
    SQ1.Append(
    "" & rec.town & "<BR>" & CRLF)
    SQ1.Append(
    "" & rec.County & "<BR>" & CRLF)
    SQ1.Append(
    "<A href='geo:0,0?q=" & rec.Libname & "%20" & rec.postcode & "'>" & rec.postcode & "<BR><BR> " & CRLF)
    SQ1.Append(
    "<A href='Tel:" & rec.Phone & "'>" & rec.Phone & "</a>" & CRLF)
    SQ1.Append(
    "<UL>" & CRLF)
    SQ1.Append(
    "        ")
            Result=SQ1
    I've attached a Zipped Version of the Excel SpreadSheet that does this. Obviously this contains macros, so it will trigger the usual Anti-virus etc alarms when you unzip, download and open it etc

    Of course once we get B4I Version 2.00 there will be no need for this, so hopefully it will be redundant next week!

    Derek
     

    Attached Files:

  2. Erel

    Erel Administrator Staff Member Licensed User

    Thank you for sharing it. Hopefully B4i v2.00 beta will be released next week or the week afterwards.
     
    Derek Johnson likes this.
Loading...