Removing Commas From Csv File
having problems removing commas from my form input. Have a form that is bringing back text strings from users. when it gets put into CSV file, any commas the user has entered get moved onto new rows.
View Replieshaving problems removing commas from my form input. Have a form that is bringing back text strings from users. when it gets put into CSV file, any commas the user has entered get moved onto new rows.
View RepliesI'm dynamically building an SQL string to do an execute, and keep ending up with a leftover comma, so the string looks like this.
INSERT INTO Software ( Title, Version, Licensing, Total_Licenses, support_phone, support_email, Campuses_Licensed, Comments, support_web, FundingSource, Course_title, Subject, Grade_level, LocalExpert, ACTIVE, CATE, EntryDate,) VALUES ( 'Bob's Super Crappy Software', '4.3', 'labpack', '36', '555', '555', 'Alexander, Bilhartz, Central, Fairmeadows, Hyman, Daniel', 'James is testing this', 'www.bob.com', 'Campus PO', 'Math', 'Math', '4, 5, 6', 'Patrick Williams', '1', '0',)
Both commas are added dynamically and can be trimmed on the fly. I tried using RTRIM(strSQL, ",") but this didn't work.I put the fields into an array and tried to add only commas to all but the last entry, but that also didn't work.
How is the best way to handle commas in data in CSV files? I'm currently using the following:
set fso = createobject("scripting.filesystemobject")
set act = fso.opentextfile(server.mappath("filename.csv"))
itext = act.readall
arrlist = split(itext,chr(10))
and then looping through the rows and splitting at commas. However, some of the data has commas in it, which is throwing things off.
4 months into the land of ASP and I still have newb questions.I have a simple string.
centertype = Type1 & Type2 & Type3 & Type4 & Type5
How do I add a comma to seperate this string? Keep in mind that some of the values may be blank.
i.e. Type1 = ""
or Type4 = ""
I need to create a string along the lines of "23,43,78,23" with no comma at the beginning or end of it. The data comes out of a table so i've created a loop to get the data and form the string :
StrRecip = "," & objRS("number") & StrRecip
This will give me something like : ",42,78,67,2,90"
And then I've removed the leading comma :
StrRecipRem = replace(StrRecip, ",", "", 1, 1)
Is there actually a better way ?
Using ASP/VB I need to remove unwanted commas from the end of a field
that will be use in an array. There are items in the field that are
comma separated, so I don't want to remove them, just the end ones,
could be anywhere up to 5 unwanted commas.
Any ideas?
I'm importing data from a csv file but have the following problem.
It see any comma in a specific column as the end of the current column and move the rest of the values into the next column I.E Data from column 4 display as data from column 5.
I do know that it's comma delimited but would like to know if there's no way that I can distinguish between the commas in a column and the commas that indicate a new column.
Col1 Col2 Col3 Col4 Col5
Value Value Value Val,ue Value
How do they do it in excel?
I don't know if anyone has encountered this before. I've written ASP code to insert, update and delete records from Access and SQL Server tables before but this is the first time I face this issue -
I have a form that inserts data into an Access table. For a few of the fields, commas are getting inserted into the table. If the field is left blank, there is a comma inserted. If we enter data in the field, the comma is appended to the field value (eg: smith, )
The only thing different that i'm doing here from what I've done before is I'm inserting a larger number of fields into the table - 117 fields!!
Do you think the insert statement hasn't been written correctly?
I have a price field in a cms,it can deal with full stops fine, but i cant understand why it wont accept commas.
View Replies View RelatedI would like to know if you can display only certain data into a field between commas or any other symbol without using the curshort feature. For example. I have the following.
Part, A3472, Desc: Controller: Price$ 45.00
I just need this out of it in a single form field.
A3472
I cannot use the cutshort feature because my part numbers are different lengths.
let say i got a string:
apple, orange, durian
how to check got how many commas in this string? how to check beside the commas is space or not space? if the words beside the commas is space, i wan to remove the space? if the words got commas, i have to remove the space.
I have a simple script I found that increments a number in a text file. I was wondering if anyone has a routine that will commify the number. Code:
View Replies View Relatedhow to avoid an error when calling data to a text form field that contains inverted commas? When I enter "inverted commas" into a text field on a form and save to my Access database, after save the text field appears to be blank but when I look in the database it appears as entered. The problem is when the text field calls the field it doesn't show if the text is encased in inverted commas.
For instance, in my form field 'title' I enter: Big Title "Yeah" After saving the form, all that appears within the form field 'title' is: Big Title Yet the access database itself shows: Big Title "Yeah"
I would like to know if you can display only certain data into a field between commas or any other symbol without using the curshort feature. Code:
View Replies View RelatedI have a string --> 7,8,9,10. This string may contain more or less than 4 numbers.
I want to separate each number and run an sql query for each number.
for example:
select * from table1 where code = '7'
select * from table1 where code ='8'
and etc....
Can I do this in a loop?
how do i count the number of values sent accross the form post seperated by commas ?
e..g 43352352,325324452,235234452,24523454
i have a SQL text field that has linebreaks in it, when i try to display the field in my java/asp script it doesn't work. so i'm thinking i need to replace my linebreaks with <Br>?
is that what i need to do? Code:
Does ASP have any function to remove ZEROS from LEft??
or shoud i write one?
000025120 -> 25120
000000012 -> 12
I have set up a page specifically for printing, however, I would like to be able to choose certain items on the page that are to be ignored by the printer. For example, the web version of the page may have instructions on how to print, although the version that is printed off does not.
View Replies View RelatedI have successfully taken over a number of variables from a .csv file and put them into an .asp page. Unfortunately the .csv file has all these variables enclosed in double quotes i.e "Hello" and appear this way on the .asp page. Is there anyway of removing the double quotes (") from the beginning and end of the variables?
I have tried splitting the individual variables on the " with this
sSeg2 = Split( var1, """ )
but this brings an error..
Unterminated string constant
/iq/groupama/chamber/test3.asp, line 74, column 26
sSeg2 = Split( var1, """ )
i have a variable which is like
Code:
UsrStr = "root|1234"
ive checked the text file for it to validate it for removal, if it returns true i need to remove the line and clear that line so new lines can be added in the future.
how can i remove a spcified line from the file?
how do i remove spaces in the middle of the string?
from this:
var = "sand bag"
to this:
new var = "sandbag"
ive got a string where i woulld like to remove the last character it probably seems simple 2 u but i cant work it out
can anyone tell me how to remove it.
How do I remove any ASP code from a variable? I've got a variable returning a value with loads of ASP coding inside it and I want to remove that ASP code from the variable (any <% %> tags and anything between it).
View Replies View RelatedDoes anyone know of a way where I can remove an attribute from a querystring? For example, say my URL is thispage.asp?view=all&filter=col1 is there a way I can request the querystring but remove the filter=col1 attribute?
View Replies View RelatedI have a database which currently stores a series of urls that are displayed in a page. The title field contains the url and the title text. I use the code below to display the information.
Response.Write "<tr><span class='tabuler3'>" & "<strong>" & objRS("TITLE") & "</strong> " & objRS("START_DATE") & "<br><br>" & objRS("HOST")& "<br>" & objRS("LOCATION") & "<br><br></span><br><br></tr>"
I was wondering if there was a way of putting the url in a script instead of manually having to enter the html for each url for each record. The only field that needs to change is the "id" field.
I have a form that seems to add a comma to the end of the email address, ive looked all over the form for this random comma which i cannot find, the comma is definately there before i perform any sort of email error checks, however ive pretty much given up trying to find where its added, but i was wondering, is there something you can add which removes the last character of a field, before it gets entered into the database, something like a comma?
View Replies View RelatedI'm running IIS on Win2K Advanced Server. My backend database on unix
gets suspended each night for backup purposes. This causes problems
for the middleware if users try to access the database during this
time.
So I thought I'd redirect all requests for pages in my app to a page
saying the site is offline temporarily (ten minutes)
I'm trying to do this using VBScript, exposing the IIS architecture
using
set iisobj = GetObject("IIS://localhost/W3svc/1/ROOT/apps")
where "apps" is the name of the virtual directory where my app
resides. I redirect using
iisobj.Put "HttpRedirect", "http://mymachine/offline.asp,
EXACT_DESTINATION"
and all this works fine. Code:
I need to remove a period from a string of data. I have a whole column
of numbers that have a period distributed randomly in them, and I need
a way to pull the period out. Unfortunatly, the period is not at a
fixed interval from the start or from the end. Sometimes it's like
this: 08307.33214
and sometimes it's like this: 66543354.2213
At any rate, I have a whole column of these in SQL Server 7.0 and need
to use the number as is for some issues, but without the period for
others.
Can someone please show me how to write a function that will remove
the period no matter where it is located in the string?
I have an ASP function in place to strip invalid chars out of a data store
before I create an XML file of this data, but my function doesn't work on a
certain set of chars.
As far as I can see these are the following:
a) trademark char
b) long hyphen/dash char
c) smart/curly quotes (both left and right)
Even though my function is set up as follows: Code:
I have a permission tracking app that I am working on, and I have made the insert page for it. I am having issues on how to prevent duplicates from getting entered.
Currently the interface for the app has a mixture of select boxes, list boxes and checkboxes. The form submits the page to processAIMR.asp and then does the inserting. I am using a loop to insert a new record for each checkbox checked or listbox entry selected. Code:
I have a link that looks like this
http://www.anysite.com/ class="someclassname"
It looks exactly like the above link (minus the fact that anysite and someclassname are variables)
I have an array of lets say 10 items, I now want to remove an item, lets say
from somewhere in the middle, based on one of the element values equalling a
value I specify - is there a "clever" and "quick" way of doing this or, will
I need to iterate through it looking for a match, and build another array
where I dont find the match etc...