/*
 * D2F
 * Copyright (C) SatisKia. All rights reserved.
 */

#include "_Global.h"

class _StringUtil
{
	static function trim( str:String ):String
	{
		var ret:String = new String( "" );
		var i:Number;
		var top:Number = 0;
		for( i = 0; i < str.length; i++ )
		{
			if( (str.charAt( i ) != " ") && (str.charAt( i ) != "　") )
			{
				break;
			}
			top++;
		}
		if( top < str.length )
		{
			var end = str.length - 1;
			for( i = end; i >= 0; i-- )
			{
				if( (str.charAt( i ) != " ") && (str.charAt( i ) != "　") )
				{
					break;
				}
				end--;
			}
			ret = str.substring( top, end + 1 );
		}
		return ret;
	}
}
