Maintain space between field entries.

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
keyless
Posts: 211
Joined: Wed Dec 12, 2007 11:21 pm

Maintain space between field entries.

Post by keyless » Fri Aug 01, 2008 6:41 am

I have a field where user will enter several file extension (without the "."). I'm drawing a blank as to how to make sure each one is separated by only one space.

I'm thinking basically on closeField I want to replace any consecutive spaces greater than 1 with a single space.

keyless
Posts: 211
Joined: Wed Dec 12, 2007 11:21 pm

Re: Maintain space between field entries.

Post by keyless » Fri Aug 01, 2008 7:21 am

keyless wrote:I have a field where user will enter several file extension (without the "."). I'm drawing a blank as to how to make sure each one is separated by only one space.

I'm thinking basically on closeField I want to replace any consecutive spaces greater than 1 with a single space.
Somthing like this I suppose, but suspect it needs a repeat of some sort.

on closeField
put me into aString
replace (space & space) with " " in aString
put aString into me
end closeField

keyless
Posts: 211
Joined: Wed Dec 12, 2007 11:21 pm

Post by keyless » Fri Aug 01, 2008 8:19 am

found this worked great.

put replaceText(fld "extent"," +"," ") into fld "extent"

Post Reply