Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how to trim a string value?

Posted on 2002-04-07
1
Medium Priority
?
270 Views
Last Modified: 2012-05-04
hai,

I have a text file which I need to upload in to the server& later parse in to db.
In the txt file the fields r separated by , & enclosed by
".

I can split the values in txt file using explode fn.
$piece=explode(",",$fcontents[$i]);//where $fcontents contains the text file loaded in to the server.

b4 parsing in to db, I try to trim the function to eliminate "(double quotes) by below coding

strlen(trim($piece[0]))==13;

but still I could see values with double quotes when I try to display it in the browser b4 parsing.

can anyone guide me on how to prevent double quotes from being displayed.

thank you,
harish





0
Comment
Question by:harishsai
1 Comment
 

Accepted Solution

by:
nfuids earned 90 total points
ID: 6924535
trim won't take the " out.. trim takes spaces out of the variable..

try str_replace or ereg_replace ..
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question