Solved

how to trim a string value?

Posted on 2002-04-07
1
249 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 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Checking CSRF token within a function 36 74
ignore other .htaccess 2 43
send post values 7 26
Could you point what is avoiding the PHPExcel library to fill the sheet? 8 29
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

815 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now