"wbr" Tag is used for that.That should be placed in angle bracket("<>").I'm representing it as wbr in the code given below as it is an html tag.
public static string WordBreak(String inString, int length)
{
StringBuilder stb = new StringBuilder();
String ret = "";
int pos;
if (length == 0)
length = 10;
while ((true))
{
if (inString.Length <= length)
{
ret += inString;
break;
}
pos = inString.IndexOf(" ");
if (pos != -1)
{
if (pos > length - 1)
{
pos = length;
ret += inString.Substring(0, pos + 1) + "wbr";
}
else
{
ret += inString.Substring(0, pos + 1);
}
inString = inString.Substring(pos + 1);
}
else
{
ret += inString.Substring(0, length) + "wbr";
inString = inString.Substring(length);
}
}
if (ret.Length > 50)
{
string temp = ret.Substring(0, 50);
stb.Append(temp);
stb.Append("....");
ret = stb.ToString();
}
return ret;
}
Regards
www.renjucool.com
2 comments:
Visit http://www.foosms.com for sending free sms.. :)
Complete tech website visit
http://24x7answers.com
Also visit
http://travel2karnataka.com
Post a Comment