Return to Snippet

Revision: 11585
at February 11, 2009 14:35 by cessnajumpin


Updated Code
private function ellipsed(fullString:String, cutOff:Number):String
{
	if(fullString.length < cutOff)
	{
	        return fullString;
	}
	else
	{
		
                var ellipsedString:String = fullString.substr(0, (cutOff - 3));
		ellipsedString += "...";
	}
	
	return ellipsedString;
}

Revision: 11584
at February 10, 2009 12:46 by cessnajumpin


Initial Code
private function ellipsed(fullString:String, cutOff:Number):String
{
	if(fullString.length > cutOff)
	{
		var ellipsedString:String = fullString.substr(0, (cutOff - 3));
		ellipsedString += "...";
	}
	else
	{
		ellipsedString = fullString;
	}
	
	return ellipsedString;
}

Initial URL

                                

Initial Description
Extremely simple... just pass in the string you want to ellipse, and the position you want to do it at. The code takes care of the rest.

Initial Title
Simply Ellipse Long Strings

Initial Tags
text

Initial Language
ActionScript 3