Ring Documentation Walkthrough #10.1 – Check Data Types 2

In the previous part we talked about the main 5 checking functions, we’ll go more deeper in checking the types this time.

These functions check the characters:

  • isAlNum

    returns true if the variable/value is digits/alphas

    see isAlNum('abc') #output: 1 (true)
    see isAlNum('123') #output: 1 (true)
    see isAlNum('abc123') #output: 1 (true)
    see isAlNum('a bc') #output: 0 (false), because the string contains a whitespace.
    see isAlNum( [1, 2, 3] ) #output: Error (Bad Parameter Type)

  • isAlpha

    see isAlpha('abc') #output: 1 (true)
    see isAlpha('123abc') #output: 0 (false)
  • isCntrl

    see isCntrl('amr' + nl) #output: 1 (true)
    see isCntrl('amr') #output: 0 (false)

  • isPrint

    This one does the opposite of isCntrl()

    see isPrint('amr' + nl) #output: 1 (true)
    see isPrint('amr') #output: 0 (false)

  • isDigit

    see isDigit('amr23') #output: 0 (false)
    see isDigit('123') #output: 1 (true)

  • isGraph

    It checks if the value can be printed, except the whitespaces.

    see isGraph('apple') #output: 1 (true)
    see isGraph('YXBw bGU=') #output: 0 (false)
    see isGraph('12345') #output: 1 (true)

  • isLower

    see isLower('ribdev') #output: 1 (true)
    see isLower('Ring') #output: 0 (false)

  • isUpper

    see isUpper('abC') #output: 0 (false)
    see isUpper('ABC') #output: 1 (true)

  • isPunct

    Check if the value is a punctuation character.

    see isPunct(',.?') #output: 1 (true)

  • isSpace

    see isSpace(' ') #output: 1 (true)
    see isSpace('consider this as a something.') #output: 0 (false)

  • isXDigit

    Check if the value is a hexdecimal.

    see isXDigit('amr') #output: 0 (false)
    see isXDigit('616d72') #output: 1 (true)


Now we’re done, The final part will be about conversions.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s