[Zope] FW: [Zope] Converting Whitespaces

Shaw, Howard ShawH@STHS.org
Thu, 11 Mar 1999 07:32:47 -0600


Once again I forgot to cc the list. Sorry.

----------
From:  Shaw, Howard
Sent:  Thursday, March 11, 1999 7:32 AM
To:  'Alexander Schad'
Subject:  RE: [Zope] Converting Whitespaces

Something in an external method similar to this should do the job.

from string import split, join

def stringtounderscore(str):
	return join(split(str," "),"_");

which is then called from your page as 
<!--#var "stringtounderscore(mystring)"-->

Alternatively, if this is something you only need occasionally, you can
code it directly in DTML...

<!--#var "_.string.join(_.string.split(mystring,' '),'_'"-->

Both of these are untested, but I have tested the join/split command in
python directly:

>>> join(split("this is a test string"," "),"_")
'this_is_a_test_string'
>>>

	----------
	From:  Alexander Schad [SMTP:ags@beehive.de]
<mailto:[SMTP:ags@beehive.de]> 
	Sent:  Thursday, March 11, 1999 6:29 AM
	To:  zope@zope.org <mailto:zope@zope.org> 
	Subject:  [Zope] Converting Whitespaces

	Hi !
	I know there is a way to convert underscores to spaces (spacify)
but i
	need it the other way around is. There a function to convert
spaces to
	underscores and if not how can i do it elseway?
	Any help would be appreciated!
	Ciao,
		Alex 


	_______________________________________________
	Zope maillist  -  Zope@zope.org <mailto:Zope@zope.org> 
	http://www.zope.org/mailman/listinfo/zope
<http://www.zope.org/mailman/listinfo/zope> 

	(For developer-specific issues, use the companion list,
	zope-dev@zope.org <mailto:zope-dev@zope.org>  -
http://www.zope.org/mailman/listinfo/zope-dev
<http://www.zope.org/mailman/listinfo/zope-dev>  )