function SplitText(text,count)
{
if(text.length > count)
{
var _temps = text.substring(0,count);
return _temps + "...";
}
else
{
return text;
}
}

Example :

var s = SplitText("serkansendur",5);

s will be "serka".

Hi,
what's your question ? if you want to put code snippets for others, to help, please go here

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.