replace carriage return with comma

Ask a Question related to Coldfusion - Getting Started, Design and Development.

  1. #1

    Default replace carriage return with comma

    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')#



    Dr. Goomba Guest

  2. Similar Questions and Discussions

    1. Carriage Return Problem
      Hello, I have written some code which extracts data from a MySQL database and stores it in a CSV file using CFFILE. However, the database...
    2. Carriage Return
      Please help me how I can enter text with carriage returns into my database. I have a Textbox with TextMode="MultiLine" Now, if inter a text...
    3. lingo carriage return
      Hi, Is their a lingo command that can insert a carriage return at the end of a line in a text field. Thanks, Ben
    4. FTP doesn't add Carriage Return from VMS to NT?
      When I try to use NET::FTP to transfer text files from VMS to NT (GET command using ASCII mode,) FTP will add the Linefeed, but not the required...
    5. Carriage return in .ini files
      Hi, I am using the FileIO xtra within my Director App to try and create an ini file that is being picked up by another application. However,...
  3. #2

    Default Re: replace carriage return with comma

    replace(number, " ", ",", "all")
    Dan Bracuk Guest

  4. #3

    Default Re: replace carriage return with comma

    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>

    mxstu Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139