Evaluating a String as code -djb
nevin at smalltalkpro.com
Sat Feb 8 23:54:32 UTC 2003
This might be useful to you:
HTMLformatter evalEmbedded: ' This is a test of <? | foo | foo := ''This
string''. foo asUppercase. ?> to see if it works ' with: HttpRequest new
Derek Brans wrote:
> Given a string, is there anyway to evaluate its contents as code in
> the current context?
> Essentially I want to write a function that given a string like this:
> ' This is a test of < | foo | foo := self bar. foo upperCase. > to see
> if it works '
> returns a string like this:
> 'This is a test of Something to see if it works'
> Thank you in advance,
> Nerd on a Wire: Web and Information Solutions
> Website Design - Database Systems - Site Hosting
> mailto:info at nerdonawire.com
> For more information, visit http://nerdonawire.com
More information about the Squeak-dev