View Single Post
Old 12-23-2013, 01:15 AM   #360
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Well, I had to create a full-blown program to do it, but here we are.

Tested with one row holding "Read - Romance/International" and the other holding "Romance/International", so it should finally work:

Code:
program:
#save stuff before " - " (optional)
start=list_item(field('tags'),-2, ' - ');
#save stuff after it (mandatory)
end=list_item(field('tags'),-1, ' - ');
#strip var 'end' to first letter of each side of the "/"
end=re(end,'([^-/])[^-/]*(/)([^-/])[^-/]*','\1\2\3');


#return a value
strcat(
#returns first letter of start, if it exists
	shorten(start,1,'',0),
#test for start, if present, return " - "
	test(start,' - ',''),
#return (stripped) end
	end	
)
I don't think plugboards can hold multiline programs, so here is a one-liner just in case (without comments):
Code:
program:start=list_item(field('tags'),-2, ' - ');end=list_item(field('tags'),-1, ' - ');end=re(end,'([^-/])[^-/]*(/)([^-/])[^-/]*','\1\2\3');strcat(shorten(start,1,'',0),test(start,' - ',''),end)
Whew! That was crazy, and pretty cool!

Last edited by eschwartz; 12-23-2013 at 01:21 AM.
eschwartz is offline   Reply With Quote