473,473 Members | 2,032 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

removing some text.

14 New Member
i'm trying to remove a portion of a sentence.

e.g.

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi mi augue, mollis at, imperdiet in, elementum in, lorem.

to look like this...

Lorem ipsum dolor sit amet, consectetuer adipiscing elit... <read more>

using rtrim() doesn't work on me since the text comes from the database.

any thoughts on this one is greatly appreciated... thanks.
Jul 20 '07 #1
2 1103
adamalton
93 New Member
There are several ways of doing it. If you want to just allow it to show x number of words then you could split it using substr(). Go to the php manual and type substr into the search box, should take you straight to the right page:
http://uk2.php.net/manual/en/index.php

Or if you wanted to split it on a certain word you could use regular expressions to split it up. Look up preg_split (also preg_match, and preg_replace) in the php manual. And here for a brief explanation of regular expressions:
http://www.regular-expressions.info/
Jul 20 '07 #2
rhx
14 New Member
There are several ways of doing it. If you want to just allow it to show x number of words then you could split it using substr(). Go to the php manual and type substr into the search box, should take you straight to the right page:
http://uk2.php.net/manual/en/index.php

Or if you wanted to split it on a certain word you could use regular expressions to split it up. Look up preg_split (also preg_match, and preg_replace) in the php manual. And here for a brief explanation of regular expressions:
http://www.regular-expressions.info/
thanks a lot adamalton!
Jul 20 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: wes | last post by:
I just installed VS .Net 2003 and now when I try to remove something from the GAC I get the error: Unable to uninstall: assembly is required by one or more applications Pending references:...
2
by: Raja Kannan | last post by:
Is there a way to remove text portion from the HTML keeping the HTML Tags using the browser, say javascript RegEx or something ? I have seen lot of examples removing HTML tags to get the text...
4
by: Steve | last post by:
Hi, I have a table which contains records of user access and searches made within an application, this is a sample of the data: response for 101 results from database in 28906 ms I only...
0
by: sameer mowade via .NET 247 | last post by:
Hello All, I have problem while dynamically removing row from the Datagrid which i have added dynamically as shown in the following code snippet. The problem is that while removing dynamically...
7
by: Brad | last post by:
I'm placing a runat=server attribute on the <title> tag in my pages, so I can read/set the title text in code. The problem is that when I subsequently change the page in design view VS is...
1
by: Benny Raymond | last post by:
I have lines of data coming from a server being written to a RichTextBox... The problem is that if I let this program run for a long period of time there are hundreds of lines of text showing up in...
24
by: RyanTaylor | last post by:
I have a final coming up later this week in my beginning Java class and my prof has decided to give us possible Javascript code we may have to write. Problem is, we didn't really cover JS and what...
6
by: bruce | last post by:
hi... i'm running into a problem where i'm seeing non-ascii chars in the parsing i'm doing. in looking through various docs, i can't find functions to remove/restrict strings to valid ascii...
7
by: David Lozzi | last post by:
Howdy, I have a shopping cart in my arraylist. Works great for adding items but I'm displaying the shopping cart in a gridview and the user can update the qty of the items. If they set it to 0,...
4
by: Ahmed, Shakir | last post by:
I need to remove text string from the list of the numbers mentioned below: 080829-7_A 070529-5_c 080824-7_O 070405_6_p The output will be : 080829-7 070529-5
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.