From 28c97a8c3542a5fca24f6b37a4a93e43a0c69ae5 Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Sun, 21 Jul 2002 07:26:44 +0000 Subject: [PATCH] Created lastchar() utility function (returns last character in string). --- src/xpdev/genwrap.c | 14 ++++++++++++++ src/xpdev/genwrap.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/xpdev/genwrap.c b/src/xpdev/genwrap.c index 20dfbae00d..da72cb4706 100644 --- a/src/xpdev/genwrap.c +++ b/src/xpdev/genwrap.c @@ -55,6 +55,20 @@ #include "genwrap.h" /* Verify prototypes */ +/****************************************************************************/ +/* Return last character of string */ +/****************************************************************************/ +char DLLCALL lastchar(const char* str) +{ + size_t len; + + len = strlen(str); + + if(len) + return(str[len-1]); + return(0); +} + /****************************************************************************/ /* Convert ASCIIZ string to upper case */ /****************************************************************************/ diff --git a/src/xpdev/genwrap.h b/src/xpdev/genwrap.h index 097630a13e..b606dfe1b5 100644 --- a/src/xpdev/genwrap.h +++ b/src/xpdev/genwrap.h @@ -123,6 +123,8 @@ extern "C" { #endif #endif +DLLEXPORT char DLLCALL lastchar(const char* str); + /****************************/ /* Common Utility Functions */ /****************************/ -- GitLab