Using variable as a itemdelimiter

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
warrenk
Posts: 110
Joined: Sun Sep 21, 2008 5:39 am

Using variable as a itemdelimiter

Post by warrenk » Sat Apr 11, 2009 12:52 am

Is the tab key always a numtochar(9)? I am trying to load the itemdelimiter with a variable. When the variable is a 'tab', I am getting a error - 'Source is not a character'.

Would it be safe to use the following for a tab delimiter?

Put numtochar(9) into gDelimiter
set itemdelimiter to gDelimiter

Or is there a better way? The value of the delimiter may change...which is why I don't harcode it:

ie. set itemdelimiter to tab

Thanks for any help!
Warren

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10049
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Post by FourthWorld » Sat Apr 11, 2009 3:25 am

Tab is one of the supported constants. Used without quotes as a value, it means the same as numtochar(9).

So your example:

set itemdelimiter to tab

..should work just fine.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Bernard
Posts: 351
Joined: Sat Apr 08, 2006 10:14 pm

Post by Bernard » Sat Apr 11, 2009 11:58 am

Not wishing to put words into Richard's mouth, but I think he is saying that if you do:
Put tab into gDelimiter
then you will achieve what you desire.

Personally, I often use some of the 'non-printing' ASCII characters (around 30 in the code table) as delimiters. As it seems that these characters ('group separator', 'record separator', etc) have generally been forgotten, I can be pretty sure that they will not occur inside any text I am processing.

I only came across one glitch doing this, and it was in transferring a stack between Windows and OS X. Rev does some automatic characters translations between the different OS, and these characters caused problems.

I thought I'd entered it as a bug, but on checking the bug database I can't find the report.

Post Reply