Solved

how to trim a string value?

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
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 …

705 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

17 Experts available now in Live!

Get 1:1 Help Now