473,396 Members | 1,921 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,396 software developers and data experts.

"Cut" String

Hello,

I created a simple blog on a web site. On homepage I am displaying the
last posts.

For each post I show the Post Title, the Post Updated Date and the
beginning of the Post Body.

When the user clicks Title it will be redirected to a new page showing
the full Post Body ....

The Post Body might contain HTML code ... the content is defined in
the variable PostBody.

How can I get the beginning part of PostBody??

- I need to be sure that I don't break HTML code;

- I would like to define an approximate length.

Is this the way how is it done?

Thank You,
Miguel
Sep 15 '08 #1
2 3438
On Sep 15, 1:14*am, shapper <mdmo...@gmail.comwrote:
Hello,

I created a simple blog on a web site. On homepage I am displaying the
last posts.

For each post I show the Post Title, the Post Updated Date and the
beginning of the Post Body.

When the user clicks Title it will be redirected to a new page showing
the full Post Body ....

The Post Body might contain HTML code ... the content is defined in
the variable PostBody.

How can I get the beginning part of PostBody??

* * *- I need to be sure that I don't break HTML code;

* * *- I would like to define an approximate length.

Is this the way how is it done?

Thank You,
Miguel
Please, anyone?

Thanks,
Miguel
Sep 15 '08 #2
After serious thinking shapper wrote :
Hello,

I created a simple blog on a web site. On homepage I am displaying the
last posts.

For each post I show the Post Title, the Post Updated Date and the
beginning of the Post Body.

When the user clicks Title it will be redirected to a new page showing
the full Post Body ....

The Post Body might contain HTML code ... the content is defined in
the variable PostBody.

How can I get the beginning part of PostBody??

- I need to be sure that I don't break HTML code;

- I would like to define an approximate length.

Is this the way how is it done?

Thank You,
Miguel
You could first filter out any html codes, that is anything between a
"<" and the next ">".
Then you will have the plain text.
If this is less than your required length, then you are done.
Else you should inspect around that position: you might be in a
&agrave; or something like that. Find out if you are between a "&" and
";". If so you can adjust to either before the "&" or after the ";".

Hans Kesting
Sep 15 '08 #3

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

Similar topics

3
by: Ronald W. Roberts | last post by:
I'm not sure where this routine came from, but here is the problem. On certian computers this error occurs, but it does not on others. The error is: "Undefined Function "DIR" in expression". ...
3
by: babylon | last post by:
any facilities in csharp that can help me implmenting undo/redo in my application? thx
8
by: Tony | last post by:
Hello I am learning C# and encountered the following problem when I tried to figure out how to print the string {0} in a Console window The following piece of codes complied OK. But when I...
2
by: deko | last post by:
Why am I getting: "Error Number 70: Permission denied" when trying to move a folder with the Microsoft Scripting Runtime? Is there some security setting I don't know about? Platform: Windows...
0
by: Ben3eeE | last post by:
I got one too hard for me to fix problem. I know the cause and i know why but i cant fix it. I am using a "Rubber band" like function, drawing a rectangle on an image in a picturebox that i...
1
by: Özden Irmak | last post by:
Hello, Does anybody know a way to get the local equvalents of strings used by explorer such as "Cut","Copy","Paste" ? Thanks in advance... Regards, Özden Irmak
4
by: FullBandwidth | last post by:
I have been perusing various blogs and MSDN pages discussing the use of event properties and the EventHandlerList class. I don't believe there's anything special about the EventHandlerList class in...
6
by: Alexnb | last post by:
Uhm, "string" and "non-string" are just that, words within the string. Here shall I dumb it down for you? string = "yes text1 yes text2 yes text3 no text4 yes text5+more Text yes text6 no...
5
by: Meganutter | last post by:
Hi, is there some sort of setting or function where you can cut the text of a textbox with "..." like you sometimes see at the browse field of an installer? example ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.