Discussion:
replace carriage return with comma
(too old to reply)
Dr. Goomba
2005-10-05 23:10:24 UTC
Permalink
i am using <cftextarea> to input numbers on each line. when i submit the form
it is outputting: 'number1 number2 number3'.

well i am trying to replace the space (which i thought would be a line break)
with a comma. however everything i try outputs the same way 'number1 number2
number3'.

#Replace(number,'#chr(32)#', ',', 'all')#
#Replace(number,'#chr(10)#', ',', 'all')#
#Replace(number,'#chr(13)#', ',', 'all')#
#Replace(number,' ', ',', 'all')#
Dan Bracuk
2005-10-05 23:24:48 UTC
Permalink
replace(number, " ", ",", "all")
mxstu
2005-10-05 23:40:31 UTC
Permalink
If there is a literal space [ chr(32) ] in between the values "number1 number2
number3", then either of these should work

#Replace(number, chr(32), ',', 'all')#
#Replace(number,' ', ',', 'all')#

However, if you need a sanity check, you can easily determine exactly what the
character values are, by removing all of the letters and numbers from the form
field and outputting the ascii values of the remaining characters (ie.
delimiters between 'number1', 'number2' and 'number3')






<!--- remove all numbers and letters from form field value --->
<cfset parsedValue = reReplaceNoCase(form.number, "[a-z,A-Z,0-9]", "", "all")>

<!--- show ascii value of remaining characters --->
<cfloop from="1" to="#len(parsedValue)#" index="i">
<cfoutput>
asc value of position[#i#] = #asc(mid(parsedValue, i, 1))#<br>
</cfoutput>
</cfloop>

Continue reading on narkive:
Loading...