net.sf.asterisk.util
Class AstUtil

java.lang.Object
  extended by net.sf.asterisk.util.AstUtil

public class AstUtil
extends java.lang.Object

Some static utility methods to handle Asterisk specific stuff.
See Asterisk's util.c.

Version:
$Id: AstUtil.java,v 1.1 2005/07/26 12:16:03 srt Exp $
Author:
srt

Method Summary
static boolean isTrue(java.lang.String s)
          Checks if a String represents true or false according to Asterisk's logic.
The original implementation is util.c is as follows:
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isTrue

public static boolean isTrue(java.lang.String s)
Checks if a String represents true or false according to Asterisk's logic.
The original implementation is util.c is as follows:
    int ast_true(const char *s)
    {
        if (!s || ast_strlen_zero(s))
            return 0;
     
        if (!strcasecmp(s, "yes") ||
            !strcasecmp(s, "true") ||
            !strcasecmp(s, "y") ||
            !strcasecmp(s, "t") ||
            !strcasecmp(s, "1") ||
            !strcasecmp(s, "on"))
            return -1;
    
        return 0;
    }
 

Parameters:
s - the String to check for true.
Returns:
true if s represents true, false otherwise.


Copyright © 2004-2005 Stefan Reuter. All Rights Reserved.