content: -- replaceSimple({sourceTEXT:"", oldChars:"", newChars:"", considerCase:""})
  -- Daniel A. Shockley http://www.danshockley.com
  -- takes some string and replaces every instance of oldChars with newChars. Optionally considers case.
  
  
  (*
  HISTORY:
  	1.4 - Convert sourceText to string, since the previous version failed on numbers. 
  	1.3 - The class record is specified into a variable to avoid a namespace conflict when run within FileMaker. 
  	1.2 - changes parameters to a record to add option to CONSIDER CASE, since the default changed to ignoring case with Snow Leopard. This handler defaults to CONSIDER CASE = true, since that was what older code expected. 
  	1.1 - coerces the newChars to a STRING, since other data types do not always coerce (example, replacing "nine" with 9 as number replaces with "")
  	1.0 - created
  *)
  
  
  on run
  	--replaceSimple({sourceTEXT:"hello", oldChars:"l", newChars:"r"})
  	replaceSimple({"hello", ASCII character 0, ""})
  end run
  
  
  --------------------
  -- START OF CODE
  --------------------
  
  on replaceSimple(prefs)
  	-- version 1.4
  	
  	set defaultPrefs to {considerCase:true}
  	
  	if class of prefs is list then
  		if (count of prefs) is greater than 3 then
  			-- get any parameters after the initial 3
  			set prefs to {sourceTEXT:item 1 of prefs, oldChars:item 2 of prefs, newChars:item 3 of prefs, considerCase:item 4 of prefs}
  		else
  			set prefs to {sourceTEXT:item 1 of prefs, oldChars:item 2 of prefs, newChars:item 3 of prefs}
  		end if
  		
  	else if class of prefs is not equal to (class of {someKey:3}) then
  		-- Test by matching class to something that IS a record to avoid FileMaker namespace conflict with the term "record"
  		
  		error "The parameter for 'replaceSimple()' should be a record or at least a list. Wrap the parameter(s) in curly brackets for easy upgrade to 'replaceSimple() version 1.3. " number 1024
  		
  	end if
  	
  	
  	set prefs to prefs & defaultPrefs
  	
  	
  	set considerCase to considerCase of prefs
  	set sourceTEXT to sourceTEXT of prefs
  	set oldChars to oldChars of prefs
  	set newChars to newChars of prefs
  	
  	set sourceTEXT to sourceTEXT as string
  	
  	set oldDelims to AppleScript's text item delimiters
  	set AppleScript's text item delimiters to the oldChars
  	if considerCase then
  		considering case
  			set the parsedList to every text item of sourceTEXT
  			set AppleScript's text item delimiters to the {(newChars as string)}
  			set the newText to the parsedList as string
  		end considering
  	else
  		ignoring case
  			set the parsedList to every text item of sourceTEXT
  			set AppleScript's text item delimiters to the {(newChars as string)}
  			set the newText to the parsedList as string
  		end ignoring
  	end if
  	set AppleScript's text item delimiters to oldDelims
  	return newText
  	
  end replaceSimple
  
  --------------------
  -- END OF CODE
  --------------------
  