none
quotes and other strange charaxters in text RRS feed

  • General discussion

  • In the past (2010 ?) several questions on this topic  - quotes inside variables, etc in the smallbasic forum and I don't found any answer, even they told it was impossible.  

    I wrote several programs to handle GPX files (standard GPS files) in small basic, to remove blocs such as comment, description, time, sym, name extensions, metadate, waypoints, replace routepoints by waypoints, etc in GPX-files to correct them for use in different GPS's and smartphones .

    I don't know if today combining variables such as in next example are a problem. If somebody is interrested I can document it on the forum or I can send it to Ed or Nonki to write it in perfect english

        <rtept lat="50.382021451368928" lon="4.853162337094545""Hello"/>

     

    Friday, November 16, 2018 6:32 PM

All replies

  • Hi Eddy

    <rtept lat="50.382021451368928" lon="4.853162337094545""Hello"/>

    Looks most similar to variables you see in htm or html files.

    Sometimes .csv files that are downloaded also have quotes as additional delimitators in addition to commas. 

    Friday, November 16, 2018 10:05 PM
  • You can form a string in Small Basic by concatenating any ascii character codes including quotes.

    For example:

    sq = Text.GetCharacter(39) 'Single quote '
    dq = Text.GetCharacter(34) 'Double quote "
    lat = "50.382021451368928"
    lon = "4.853162337094545"
    loc = "Hello"
    xml = "<rtept lat="+dq+lat+dq+" lon="+dq+lon+dq+dq+loc+dq+"/>"
    TextWindow.WriteLine(xml)

    You can also use unicode characters with values greater than 255.

    See https://unicode-table.com/en/

    Saturday, November 17, 2018 8:09 AM
    Moderator
  • hey thanks,

    it's a lot easear then years ago.

    I was still using the old songproblem  “there is a hole in my pocket, dear Liza”. So put your money elsewhere.

    That’s what I did in the seventies when I couldn’t use Arrays for some thousands of variables on a 16K-computers at HP so I was just writing them down in the records of a file.

    So you can write down an XML-record

    <rtept lat="50.382021451368928" lon="4.853162337094545">

    in a file (inputfile) with blocnotes and then read it back.

    And in the same way create a file quotefile with a single line “

    Some testing in a small program :

    Inputfile="input.gpx"

    quotefile="quote.txt"

    outputfile="output.gpx"

    Myline=File.readLine(InputFile,1)

    quote=File.readLine(quotefile,1)

    GraphicsWindow.DrawBoundText(10,10,600,"Myline :      "+Myline)

    GraphicsWindow.DrawBoundText(10,30,600,"Myline :      "+quote+Myline+quote)

    NewLine=quote+Myline+quote

    GraphicsWindow.DrawBoundText(10,50,600,"Newline :   "+Newline)

    File.writeline(outputfile,1,newline)

    GraphicsWindow.DrawBoundText(10,70,600,"output :     "+File.readLine(outputFile,1))

    Finally : If you have a route in a GPX-File The traject depends on a lot of settings the GPS is calculating different for hiking or another activity – making the GPS-file also dependent from the manufacture of the GPS, the editing program (such as basecamp of garmin), etc

    It’s relatively easy to take only the important information and the lines with  

    <rtept lat="50.382021451368928" lon="4.853162337094545">    or

    <gpxx:rpt lat="50.381471514701843" lon="4.853151440620422"/>

    And change them to trackpoints

    <trkpt lat="50.382021451368928" lon="4.853162337094545"/>    or

    <trkpt lat="50.381471514701843" lon="4.853151440620422"/>

     For me the most difficult part is to put an program-example on the smallbasic-site





    • Edited by Eddy Abts Saturday, November 17, 2018 12:37 PM
    Saturday, November 17, 2018 9:34 AM
  • To publish a Small Basic program:

    with the program in the IDE (working window) click on the "Publish" button. Then you get a 6 character string in the form ABC123, which you can refer to. Everybody can then download the program by using "Import" and givig that string.

    Jan [ WhTurner ] The Netherlands

    Saturday, November 17, 2018 3:39 PM
    Answerer
  • Hello Jan,

    It's working well ... but too fast. There is no confirmation-question so the file I am working on is gone to the server !

    So still some questions.

    1. Are there explications (manual) on the smallbasic-editor IDE  (and the forum-site organisation such as where is the list of the programs samples?)

    2. I still don't find - how to delete or edit a file that is gone to the server with this publish button ?

    3. Is there a shortcut (one key) to find some text in a file ?  The text is highlighted but when you use the arrows to go to next occurency the highlight disapeares. And I can't find a replace option

    4. How to print the sourcefile with the linenumbers from the editor

    ... Is there a possibility to send a mail directly to you or another moderator ? It's easier for me to send a mail in Dutch, French, etc and I am living in belgium

    thanks for your help




    • Edited by Eddy Abts Saturday, December 15, 2018 10:26 PM
    Saturday, December 15, 2018 10:21 PM
  • Hi,

    1] Documentation for Small Basic is somewhat distributed, here is a good place to start looking.  For specific questions this forum is the best place.

    2] You cannot delete a published program, but no worries, just forget about it.

    3] Control+F to find and F3 to find next.  There is no replace in the SB IDE, perhaps try SB-Prime or copy code to something like Notepad++ to edit text and then copy back to SB.

    4] Again copy to another text editor to print or use SB-Prime.

    Sunday, December 16, 2018 2:19 PM
    Moderator
  • It's great and a quick answer on my questions. 

    The link to "here" is extremely useful and a quick way to find explanations on "The small basic environment (IDE)", "shortcuts for keyboard" and a lot of interesting stuff, such as the stack commands, for me back to history. 

    "Just forget" about the code of a published program is something you just need to know, such as the hint to print via some other programs. It's called "experience" ...

    I am finishing a program to clean GPX-files. Removing information such as date, heart-beat, but also waypoints, metadata and other information you don't need, or giving trouble with other GPS's.  Transfer route-points to waypoints or trackpoints, etc. I just need to finalize the logging for debugging.  So if some people are interested I will try to find out how to distribute it to the small-basic environment. There is the executable-file, a config-file, the basic library, and one or two GPX-files as example.   

    Thanks a lot for the help ! 


    • Edited by Eddy Abts Sunday, December 16, 2018 4:56 PM
    Sunday, December 16, 2018 4:43 PM