Lasso Soft Inc. > Home

[c5_shortunique]

Linkc5_shortunique
AuthorJason Huck
CategoryUtility
Version7.x
Licensehttp://opensource.org/licenses/artistic-license.php
Posted16 Jan 2006
Updated16 Jan 2006
More by this author...

Description

Generates a 14-character string based on the current datetime that should be unique in all but the most extreme cases. Useful in cases where you need to, for instance, create a unique, non-linear filename and [lasso_uniqueid] is just a few characters too long (with a dot-three extension) to guarantee safe file transfer via FTP.

Sample Usage

[c5_shortunique]

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

define_tag: 'c5_shortunique';
	local: 'chars' = (map:
		0 = 'AaZz',
		1 = 'BbYy',
		2 = 'CcXx',
		3 = 'DdWw',
		4 = 'EeVv',
		5 = 'FfUu',
		6 = 'GgTt',
		7 = 'HhSs',
		8 = 'IiRr',
		9 = 'JjQq'
	);
	
	local: 'time' = (string: date->(format: '%Y%m%d%H%M%S'));
	
	local: 'out' = string;
	
	iterate: #time, local: 'thisDigit';
		local: 'rnd' = (math_random: -min=1, -max=5);
		#out = #chars->(find: (integer: #thisDigit))->(get: #rnd) + #out;
	/iterate;
	
	return: #out;
/define_tag;

Related Tags

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft