poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@superlinksoftware.com
Subject Re: Detect unicode
Date Thu, 28 Apr 2005 15:04:53 GMT
I'm betting on the latter.  I think the former is legacy code from when 
we supported 1.22 or something.

Avik Sengupta wrote:
> We currently have two methods to detect unicode characters. Which is
> better? Primarily on performance. I want to consolidated. There might be
> other such code scattered! 
> 
> 	public static boolean hasMultibyte(String value){
> 	    if( value == null )return false;
> 	    for(int i = 0 ; i < value.length() ; i++ ){
> 	        char c = value.charAt(i);
> 	        if(c > 0xFF )return true;
> 	    }
> 	    return false;
> 	}
> 	
> 	 public static boolean isUnicodeFormat(final String format) {
> 	    try {
> 	      return !format.equals( new String(format.getBytes ("ISO-8859-1"),
> "ISO-8859-1"));
> 	    } catch (UnsupportedEncodingException e) {
> 	      return true;
> 	    }
> 	  }


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


Mime
View raw message