mudgangster

Log | Files | Refs

commit 84b6ded538ec2b87a0db6bc1e090a7d276611477
parent a24716c9366f43ce0c0d2dae9fe7a715d504fd72
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Fri,  7 Dec 2012 02:50:09 +0000

Add ignoreCase option to string.startsWith

Diffstat:
utils.lua | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/utils.lua b/utils.lua @@ -10,7 +10,11 @@ function string.plural( count, plur, sing ) return count == 1 and ( sing or "" ) or ( plur or "s" ) end -function string.startsWith( self, needle ) +function string.startsWith( self, needle, ignoreCase ) + if ignoreCase then + return self:lower():sub( 1, needle:len() ) == needle:lower() + end + return self:sub( 1, needle:len() ) == needle end