@@ -305,6 +305,41 @@ function trim(ByVal s$ as String, ByVal rep$ as String) as String
305305 return ltrim(rtrim(s$, rep$), rep$)
306306end function
307307
308+
309+ ' ----------------------------------------------------------------
310+ ' function isdigit(ByVal s$)
311+ '
312+ ' Returns not 0 if the first element of s$ is a digit,
313+ ' or 0 otherwise.
314+ ' For example:
315+ ' isdigit("a") returns 0, isdigit("2") returns 1
316+ ' ----------------------------------------------------------------
317+ function isdigit( ByVal s$ as String ) as ubyte
318+ dim asc_key as ubyte = code( s$( 0 ) )
319+
320+ return asc_key >= code( "0" ) _
321+ and asc_key <= code( "9" )
322+ end function
323+
324+
325+ ' ----------------------------------------------------------------
326+ ' function isletter(ByVal s$)
327+ '
328+ ' Returns not 0 if the first element of s$ is a letter,
329+ ' or 0 otherwise.
330+ ' For example:
331+ ' isletter("0") returns 0, isletter("a") returns 1
332+ ' ----------------------------------------------------------------
333+ function isletter( ByVal s$ as String ) as ubyte
334+ dim asc_key as ubyte = code( s$( 0 ) )
335+
336+ return ( asc_key >= code( "a" ) _
337+ and asc_key <= code( "z" ) ) _
338+ or ( asc_key >= code( "A" ) _
339+ and asc_key <= code( "Z" ) )
340+ end function
341+
342+
308343#undef __MAX_LEN__
309344
310345#pragma pop(string_base)
0 commit comments