C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » ASP.NET WebForms »

Inserting brakes in a long text


Posted Date: 28 Oct 2008    Resource Type: Code Snippets    Category: ASP.NET WebForms
Author: Prasanth Kumar S.DMember Level: Gold    
Rating: 1 out of 5Points: 10



This code show how to insert brakes in long text..



public string insertBreak(string strMessage, int cdeIndex)
{
String jobname = strMessage;
if (jobname.Length > cdeIndex)
{
int k = cdeIndex;
int j = (jobname.Length / k);


for (int i = 0; i < j; i++)
{
int cdeDifference = 0;
int cdeFindspace = 0;
if ((k + 10) < jobname.Length)
{
cdeFindspace = jobname.IndexOf(" ", k - 2, 10);
}
else { cdeFindspace = -1; }
if (cdeFindspace != -1)
{
cdeDifference = cdeFindspace - k;
k = cdeFindspace;

}
jobname = jobname.Insert(k, "<br />");
if ((k + (k + 6)) < jobname.Length)
{
k = k + (k + 6) + (cdeDifference);
}
else
{
break;
}
}
}
return jobname;
}


For more details, visit INSERTING BRAKS IN A LONG TEXT




Responses

Author: Pradeep Iyer    29 Oct 2008Member Level: Diamond   Points : 0
hi prasanth,

nice function

regards,
pradeep


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Long text  .  Insert  .  Brakes  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Listbox-binding data to a list box
Previous Resource: Using FileUpload control and its validation in asp.net
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET WebForms


Post resources and earn money!
 
Related Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use