Solved

how to trim a string value?

Posted on 2002-04-07
1
253 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
nfuids earned 30 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

Suggested Solutions

Title # Comments Views Activity
How to use session variables in php? 22 89
how can I see the time difference in only seconds? 4 39
php non-object 7 28
Position image fpdf 4 18
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

738 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