I started with one of Peter's AU06 routines to create a table (TableMagic.LSP - great code Peter!)
and what I need to do is combine list positions 3,4,&5 and 6,7 & 8, add some extra text to the string,
then create a new list with the same position 1 & 2 entries and add the resultant strings to convert the original list from an 8 entity list to a 4 entity list
Here is one line of the external text file I am working with:
10176,0+00.00,37,49,56.35,109,58,0.98
here is part of the code that I am trying to wrap my head around.
Code:
; Utility to import a comma separated ascii text file into a list of sublists
(defun UELS:CSVFiletoList (strFilename ; String Filename
strChar ; String Delimiter
/
lstOfSublists ; List of Sublists
strText ; String of Delimited Strings
fil) ; File ASCII Comma Separated Values
(setq fil (open strFilename "r"))
(while (setq strText (read-line fil))
(setq lstOfSublists (cons (UELS:CSVStringToList strText strChar) lstOfSublists)))
(close fil)
(reverse lstOfSublists)
)
; Parsing a textstring to a list.
(defun UELS:CSVStringToList (strText ; String of Delimited strings
strChar ; String Delimiter
/
intPosition ; Integer String Character Index
lstStrings) ; List of Strings
(while (setq intPosition (vl-string-search strChar strText 0))
(setq lstStrings (cons (substr strText 1 intPosition) lstStrings)
strText (substr strText (+ intPosition 1 (strlen strChar)))))
(reverse (cons strText lstStrings))
)
;**************************************************************************************
;**************************************************************************************
;This function concatenates the Latitude and longitude values
(defun UELS:LatLongComp (/ lstSublist)
(setq strCompressLat (strcat "N" (nth 2 lstSublist) "\U+00B0" (nth 3 lstSublist) "\'" (nth 4 lstSublist) "\""))
(setq strCompressLong (strcat "W" (nth 5 lstSublist) "\U+00B0" (nth 6 lstSublist) "\'" (nth 7 lstSublist) "\""))
)