/*
    ============================================================
    * Information   : prototype for string
    * Version       : 1.00
    * Date          : 2010-03-03
    ============================================================
    * Author        : Kwon Hyeoung Bin
    * Contact       : Cukanis@cukanis.com
    * Homepage      : http://www.cukanis.com
    ============================================================
    * Description   : trimLeft, trimRightÃß°¡
    ============================================================
*/
String.prototype.trim = function(){ return this.replace(/(^s*)|(s*$)/g, ""); }
String.prototype.trimLeft = function(len)
{
    var str = this;
    return str.substring(len, str.length);
}
String.prototype.trimRight = function(len)
{
    var str = this;
    return str.substring(0, str.length-len);
}
String.prototype.noHtml = function()
{
    var strReturn = ((this.replace('"', '&amp;')).replace('"', '&quot;')).replace('\'', '&#39;');
    return (strReturn.replace('<', '&lt;')).replace('>', '&gt;');
}
String.prototype.getLength = function()
{
    var strLength   = this.length;
    var strLengthReal = 0;
    var tmpascii

    for(var i=0; i<strLength; i++)
    {
        tmpascii = this.charCodeAt(i)
        if(tmpascii <= 0 || tmpascii >= 255)
        {
            strLengthReal += 1;
        }
    }
    return strLength + strLengthReal;
}
String.prototype.left = function(len)
{
    var str = this;
    var j = 0;
    for(var i=0; i<str.length; i++)
    {
        j += (str.charCodeAt(i) > 128) ? 2 : 1;
        if(j > len)
        {
            return str.substring(0,i);
        }
    }
    return str;
}
String.prototype.right = function(len)
{
    var str = this;
    return str.substring(str.length-len,str.length);
}
