From 07bb50ec9052663e458f329c9c01a4de7f988d7b Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 3 Jan 2003 22:51:01 +0000 Subject: [PATCH] add IsHexVal. --- stepmania/src/RageUtil.cpp | 13 +++++++++++++ stepmania/src/RageUtil.h | 1 + 2 files changed, 14 insertions(+) diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index a02e3483f0..982890cfd8 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -43,6 +43,19 @@ bool IsAnInt( const CString &s ) return true; } +bool IsHexVal( const CString &s ) +{ + if( s[0] == '\0' ) + return false; + + for( int i=0; s[i]; i++ ) + if( !(s[i] >= '0' && s[i] <= '9') && + !(toupper(s[i]) >= 'A' && toupper(s[i]) <= 'F')) + return false; + + return true; +} + float TimeToSeconds( CString sHMS ) { CStringArray arrayBits; diff --git a/stepmania/src/RageUtil.h b/stepmania/src/RageUtil.h index befea337db..16e2abf9aa 100644 --- a/stepmania/src/RageUtil.h +++ b/stepmania/src/RageUtil.h @@ -114,6 +114,7 @@ inline float froundf( const float f, const float fRoundInterval ) int power_of_two(int input); bool IsAnInt( const CString &s ); +bool IsHexVal( const CString &s ); float TimeToSeconds( CString sHMS ); CString SecondsToTime( float fSecs );