473,320 Members | 1,947 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Whitespacing in processing strings.

Hi all,

I am a relative newbie to the PHP language but at present I am trying
to write some code that would process text (in a string, not an
array)by the explode() method. Basically, I want to seperate different
words out by using the explode(" ", $text); command, yet I find that
this approach tends to die when I perform this on strings taken from
texts with carriage returns in.

Any suggestions to tackling this problem would be greatly appreciated!
William Cheung
Jul 17 '05 #1
2 1743
William Cheung wrote:
Hi all,

I am a relative newbie to the PHP language but at present I am trying
to write some code that would process text (in a string, not an
array)by the explode() method. Basically, I want to seperate different
words out by using the explode(" ", $text); command, yet I find that
this approach tends to die when I perform this on strings taken from
texts with carriage returns in.
Hi William,

dies?
I don't believe that.
I think you made a mistake in your code instead causing it to loop forever.
Please post the relevant PHP-code so we can check.

Any suggestions to tackling this problem would be greatly appreciated!
William Cheung


Regards,
Erwin Moller

Jul 17 '05 #2
Hi William,
Haven't tested this, but it occurs to me that you may be able to remove
the carriage returns with strstr. If that fails, try preg_split:
http://us4.php.net/preg_split

Good luck,

Eric

"William Cheung" <ga******@hotmail.com> wrote in message
news:32**************************@posting.google.c om...
Hi all,

I am a relative newbie to the PHP language but at present I am trying
to write some code that would process text (in a string, not an
array)by the explode() method. Basically, I want to seperate different
words out by using the explode(" ", $text); command, yet I find that
this approach tends to die when I perform this on strings taken from
texts with carriage returns in.

Any suggestions to tackling this problem would be greatly appreciated!
William Cheung

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: D | last post by:
Hi folks, This may be pretty simple for you guys but it has me stumped. BTW I'm using Java 1.1, I know it's old, don't ask me why, I just have to. I have a long string in excess of 50k that I...
1
by: christof hoeke | last post by:
hi, i wrote a small application which extracts a javadoc similar documentation for xslt stylesheets using python, xslt and pyana. using non-ascii characters was a problem. so i set the...
8
by: OPQ | last post by:
Hi all, I'd happy to have you share some thougts about ultimate optimisations on those 2 topics: (1)- adding one caractere at the end of a string (may be long) (2)- in a dict mapping a key...
3
by: anthony hornby | last post by:
Hi, I am starting my honours degree project and part of it is going to be manipulating ASCII encoded XML files from a legacy database and converting them to Unicode and doing text processing stuff...
23
by: Daniel Rudy | last post by:
Hello, I'm trying to learn how command line arguments are handled in C. The following code segment that I wrote as a test program compiles, but when I try to run it, it core dumps. This is...
6
by: Alexander Muylaert | last post by:
Hi Does anyone know a good starting point about high speed string processing in C#? What I need is a very fast routine for a case insensitive "contains". e == E == é == ë == ... Kind...
4
by: Vinay Agarwal | last post by:
Hello, I would like to maximize efficiency of string processing in my C# application that works with Skype API. Actually, these "strings" are made of "chars" that are all 8-bit values except 0...
3
by: ecov | last post by:
Is there any easy way to read into a dataset a file that was created from a BCP command. The file is in a fixed length format. I would also like to be able to write out a dataset to the same type...
4
by: Alexis Gallagher | last post by:
(I tried to post this yesterday but I think my ISP ate it. Apologies if this is a double-post.) Is it possible to do very fast string processing in python? My bioinformatics application needs to...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.