Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 400
  • Last Modified:

Use Delete Key as Delimiter

I am trying to upload and parse a csv file.  I am told it is delimited by the DELETE key.

Each field is delimited by character 127, the delete character. Hold alt then type 0,1,2,7 in sequence will type the delete character or use "x7F" in most programming languages.

I have tried some of this and it isn't working.  Anyone have any suggestions on how to use the delete character as a delimiter?
0
theideabulb
Asked:
theideabulb
  • 2
1 Solution
 
_agx_Commented:
What have you tried? If it's ascii character 127, you should be able to use it as your loop delimiter

<cfloop list="#yourCSVContent#" delimiter="#chr(127)#" index="line">
    ....
</cfloop>
0
 
_agx_Commented:
More specifically, break it into lines as usual ie chr(10) / chr(13). Then break it into columns on the delete character ie chr(127)

<cfloop list="#theCSVContent#" delimiter="#chr(10)##chr(13)#" index="line">
    <!--- preserve missing fields --->
    <cfset columns = listToArray(line, chr(127), true)>
    ...
</cfloop>
0
 
theideabulbAuthor Commented:
i wasn't trying this #chr(127)#, i was just doing 127 or chr(127) and it kept giving errors.  Thanks for the easy solution.  I am a dummy :)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now