|
Oktatás * Programozás 1 * Szkriptnyelvek Teaching * Programming 1 (BI) Félévek Linkek * kalendárium |
Nim2 /
testing a characterIn C, these functions are in In Nim, they are in Let's see some of them: import std/strutils # is...() functions echo isDigit('9') # true # This checks 0-9 ASCII characters only. echo isLowerAscii('m') # true echo isLowerAscii('G') # false # This checks ASCII characters only. Use `unicode` module for UTF-8 support. echo isUpperAscii('m') # false echo isUpperAscii('G') # true # This checks ASCII characters only. Use `unicode` module for UTF-8 support. echo isAlphaAscii('x') # true echo isAlphaAscii('.') # false # Is the char in the English alphabet? Can be lowercase or uppercase. # This checks a-z, A-Z ASCII characters only. echo isAlphaNumeric('h') # true echo isAlphaNumeric('H') # true echo isAlphaNumeric('5') # true # This checks a-z, A-Z, 0-9 ASCII characters only. # func isEmptyOrWhitespace(s: string): bool {.....} echo isEmptyOrWhitespace("") # true echo isEmptyOrWhitespace(" \t \n ") # true echo isEmptyOrWhitespace(" \t x \n ") # false echo isSpaceAscii(' ') # true echo isSpaceAscii('\t') # true echo isSpaceAscii('\n') # true # Is the char a whitespace character? The name For Unicode support, we need the |
![]() Blogjaim, hobbi projektjeim * The Ubuntu Incident [ edit ] |