ezy_replace_string

Template

ezy_replace_string(STRING IN,REPLACE_RULE_LIST,STRING OUT)-(i,i,oi)

 

Type

 

determ

 

Description

Apply string replacement rules.

 

 

prolog_main():-

write ( "Welcome to EZY Prolog\n" ),

EDM_HREF = "Copyright 2002 EDMGROUP (Australia)\n" ,

IMAGE_REF = "[IMAGE REFERENCE] " ,

SEARCH_LIST =[

"ANOTHER TEXT TO REPLACE" , "TEXT TO REPLACE" ],

REPLACE_RULES =[

replace_any([ "ANY_TEXT" ], "ANY TEXT REPLACED" , continue ,[

find_string( "START_OF_TEXT" , continue ,[

replace_string( "NO_IMAGE_REFERENCE" , IMAGE_REF , continue ,

[replace_any( SEARCH_LIST , " EZY Prolog " , continue ,

[insert_string_before( "END_OF_TEXT" , EDM_HREF , stop ,[])

])

])

])

])],

TEXT_LINES =[

 "line with ANY_TEXT - should be replaced" ,

 "line with ANY_TEXT - should be replaced" ,

"Next line - body tag - insert tag" ,

"START_OF_TEXT" ,

"NO_IMAGE_REFERENCE Note - image tag inserted" ,

"this is message inside body tags. [ANY_TEXT]- text in brackets - replaced text",

"HREF tag to be inserted before end of the body" ,

"END_OF_TEXT"

],

slist_to_string ( TEXT_LINES , "\n" , DATA ),

write ( "INPUT TEXT=\n" , DATA , "\n______________\n" ),

ezy_replace_string ( DATA , REPLACE_RULES , RESULT ),

write ( "RESULT=\n" , RESULT,"\n" ).


 

Copyright 1998-2002 EDMGROUP (Australia)

 

Last Updated: June 30, 2002