• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

compare strings issue

kird

New Member
Joined
Jul 3, 2010
Messages
78
Reaction score
1
Hey!
How can i check if a string is written in capital letters!?

Thanks in advance

Kird~
 
Use this function
PHP:
function checkCapital(string)
	local capitals = {196,214,220,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90}
	local c = true
	for i = 1,string:len() do
		local l = string:byte(i)
		if not isInArray(capitals,l) then
			c = false
		end
	end
	return c
end
Use some function like this.
But it doest support other symbols..
 
LUA:
function isCapital(str)
    return (str:sub(1, 1):upper() == str:sub(1, 1))
end

isCapital('Hello') -> true
isCapital('hello') -> false

should work.
 
Back
Top