ooUtils.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (C) 2004-2005 by Objective Systems, Inc.
  3. *
  4. * This software is furnished under an open source license and may be
  5. * used and copied only in accordance with the terms of this license.
  6. * The text of the license may generally be found in the root
  7. * directory of this installation in the COPYING file. It
  8. * can also be viewed online at the following URL:
  9. *
  10. * http://www.obj-sys.com/open/license.html
  11. *
  12. * Any redistributions of this file including modified versions must
  13. * maintain this copyright notice.
  14. *
  15. *****************************************************************************/
  16. #include "asterisk.h"
  17. #include "asterisk/lock.h"
  18. #include "ooUtils.h"
  19. #include <ctype.h>
  20. const char* ooUtilsGetText (OOUINT32 idx, const char** table, size_t tabsiz)
  21. {
  22. return (idx < tabsiz) ? table[idx] : "?";
  23. }
  24. OOBOOL ooUtilsIsStrEmpty (const char* str)
  25. {
  26. return (str == NULL || *str =='\0');
  27. }
  28. OOBOOL ooIsDailedDigit(const char* str)
  29. {
  30. if(str == NULL || *str =='\0') { return FALSE; }
  31. while(*str != '\0')
  32. {
  33. if(!isdigit(*str) &&
  34. *str != '#' && *str != '*' && *str != ',') { return FALSE; }
  35. str++;
  36. }
  37. return TRUE;
  38. }