join columns

Phil Davis revdev at pdslabs.net
Thu Aug 28 15:17:45 EDT 2014


Before doing the 'split', you could set the columnDelimiter to whatever 
char is used as the item delimiter. In other words, you aren't limited 
to tabs as your column delimiter.

Phil


On 8/28/14, 12:10 PM, Phil Davis wrote:
> If pData is a CR-delimited list where each line contains tab-delimited 
> items, why not use 'split by column'?
>
> -- example: switch positions of columns 2 and 4
>
>    split pData by column
>    put pData[4] into tTemp2
>    put pData[2] into pData[4]
>    put tTemp2 into pData[2]
>
>
> -- then put it back together as a list:
>
>    combine pData by column
>
> That should do it.
>
> Phil Davis
>
>
>
> On 8/28/14, 11:54 AM, JB wrote:
>> Richard Gaskin wrote a function to get a column
>> from a list.
>>
>> function GetCol pData, pCol --Richard Gaskin
>>      set the itemdel to tab
>>      put empty into tReturnList
>>      repeat for each line tLine in pData
>>          put item pCol of tLine &cr after tReturnList
>>      end repeat
>>      delete last char of tReturnList -- trailing CR
>>      return tReturnList
>> end GetCol
>>
>> Does anyone know how to convert this so you can
>> join the selected columns back together in any
>> order you want?
>>
>> John Balgenorth
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your 
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>

-- 
Phil Davis





More information about the use-livecode mailing list