Giter Site home page Giter Site logo

lua-ctype's Introduction

Lua-Ctype

This module provides some new functionality:

ctype.isAlnum()
ctype.isAlpha()
ctype.isCntrl()
ctype.isDigit()
ctype.isGraph()
ctype.isLower()
ctype.isPrint()
ctype.isPunct()
ctype.isSpace()
ctype.isUpper()
ctype.isHex()

All function calls will expect a string value and will return a boolean value.

isAlnum

Checks for just alphanumeric characters.

Example:

local ctype = require("ctype")

if ctype.isAlnum("ABC12345")
then
   print("Yes")
else
   print("No")
end

isAlpha

Checks for just alphabetic characters.

Example:

local ctype = require("ctype")

if ctype.isAlpha("ABCabc")
then
   print("Yes")
else
   print("No")
end

isCntrl

Checks for just control characters.

Example:

local ctype = require("ctype")

if ctype.isCntrl("\n\r\t")
then
   print("Yes")
else
   print("No")
end

isDigit

Checks for just numerical characters.

Example:

local ctype = require("ctype")

if ctype.isDigit("12345")
then
   print("Yes")
else
   print("No")
end

isGraph

Checks for any printable characters except space.

Example:

local ctype = require("ctype")

if ctype.isGraph("ABC")
then
   print("Yes")
else
   print("No")
end

isLower

Checks for just lowercase characters.

Example:

local ctype = require("ctype")

if ctype.isLower("abc")
then
   print("Yes")
else
   print("No")
end

isPrint

Checks for just printable characters.

Example:

local ctype = require("ctype")

if ctype.isPrint("Lee")
then
   print("Yes")
else
   print("No")
end

isPunct

Checks for any printable characters which are not whitespace or alphanumeric character.

Example:

local ctype = require("ctype")

if ctype.isPunct("@")
then
   print("Yes")
else
   print("No")
end

isSpace

Checks for just whitespace characters.

Example:

local ctype = require("ctype")

if ctype.isSpace(" ")
then
   print("Yes")
else
   print("No")
end

isUpper

Checks for just uppercase characters.

Example:

local ctype = require("ctype")

if ctype.isUpper("ABCDEFGH")
then
   print("Yes")
else
   print("No")
end

isHex

Checks for just characters representing a hexadecimal digit.

Example:

local ctype = require("ctype")

if ctype.isHex("ABCDEF0123456789")
then
   print("Yes")
else
   print("No")
end

Installation

Standard

git clone git://github.com/mostvotedplaya/Lua-Ctype.git
cd Lua-Ctype/src
make
make install

Luarocks

luarocks install --server=http://luarocks.org/dev luactype

lua-ctype's People

Contributors

mostvotedplaya avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

ncisoft

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.