From 05d8f48ce3b8a2a82201ed280052443ef3152bb8 Mon Sep 17 00:00:00 2001 From: Antoine Cailliau Date: Fri, 17 Nov 2023 23:09:40 +0100 Subject: [PATCH 1/4] Introduces is* methods for strings in storm lib --- synapse/lib/stormtypes.py | 190 ++++++++++++++++++++++++++- synapse/tests/test_lib_stormtypes.py | 36 +++++ 2 files changed, 224 insertions(+), 2 deletions(-) diff --git a/synapse/lib/stormtypes.py b/synapse/lib/stormtypes.py index d8d963ab5f..edebd52d32 100644 --- a/synapse/lib/stormtypes.py +++ b/synapse/lib/stormtypes.py @@ -4392,9 +4392,135 @@ class Str(Prim): 'desc': 'Keyword values which are substituted into the string.', }, ), 'returns': {'type': 'str', 'desc': 'The new string.', }}}, - {'name': 'json', 'desc': 'Parse a JSON string and return the deserialized data.', - 'type': {'type': 'function', '_funcname': '_methStrJson', 'args': (), + {'name': 'json', 'desc': 'Parse a JSON string and return the deserialized data.', + 'type': {'type': 'function', '_funcname': '_methStrJson', 'args': (), 'returns': {'type': 'prim', 'desc': 'The JSON deserialized object.', }}}, + {'name': 'isalnum', 'desc': ''' + Returns true if all chars in the string are alphanumeric, false otherwise. + + Examples: + Test if string `aca123` is alphanumeric:: + + $foo="aca123" return ( $foo.isalnum() ) // true + ''', + 'type': {'type': 'function', '_funcname': '_methStrIsAlnum', + 'returns': {'type': 'bool', 'desc': 'Whether string is alphanumeric', }}}, + {'name': 'isalpha', 'desc': ''' + Returns true if all chars in the string are in the alphabet, false otherwise. + + Examples: + Test if string `aca` contains only letters in the alphabet:: + + $foo="aca" return ( $foo.isalpha() ) // true + ''', + 'type': {'type': 'function', '_funcname': '_methStrIsAlpha', + 'returns': {'type': 'bool', 'desc': 'Whether string only contains chars from alphabet', }}}, + {'name': 'isascii', 'desc': ''' + Returns true if all chars in the string are ASCII chars, false otherwise. + + Examples: + Test if string `aca` contains only letters in the alphabet:: + + $foo="aca" return ( $foo.isascii() ) // true + ''', + 'type': {'type': 'function', '_funcname': '_methStrIsASCII', + 'returns': {'type': 'bool', 'desc': 'Whether all the chars are ASCII', }}}, + {'name': 'isdecimal', 'desc': ''' + Returns true if all the chars are decimals (including unicode), false otherwise. + + Examples: + Test if string `123` contains only decimals:: + + $foo="123" return ( $foo.isdecimal() ) // true + ''', + 'type': {'type': 'function', '_funcname': '_methStrIsDecimal', + 'returns': {'type': 'bool', 'desc': 'Whether all the chars are decimals', }}}, + {'name': 'isdigit', 'desc': ''' + Returns true if all the chars are decimals, false otherwise. + Exponents are considered as digits. + + Examples: + Test if string `123` contains only digits:: + + $foo="123" return ( $foo.isdigit() ) // true + ''', + 'type': {'type': 'function', '_funcname': '_methStrIsDigit', + 'returns': {'type': 'bool', 'desc': 'Whether all the chars are digits', }}}, + {'name': 'isidentifier', 'desc': ''' + Returns true if the string is a valid identifier, false otherwise. + A valid identifier only contains alphanumeric letters (a-z) and (0-9), or underscores (_). + and cannot start with a number, or contain any spaces. + + Examples: + Test if string `aca_123` is a valid identifier:: + + $foo="aca_123" return ( $foo.isidentifier() ) // true + ''', + 'type': {'type': 'function', '_funcname': '_methStrIsIdentifier', + 'returns': {'type': 'bool', 'desc': 'Whether the string is a valid identifier', }}}, + {'name': 'islower', 'desc': ''' + Returns true if all the chars are in lower case, false otherwise. + Numbers, symbols and spaces are not checked, only alphabet characters. + + Examples: + Test if string `aca` only contains lower case chars:: + + $foo="aca" return ( $foo.islower() ) // true + ''', + 'type': {'type': 'function', '_funcname': '_methStrIsLower', + 'returns': {'type': 'bool', 'desc': 'Whether all chars are in lower case', }}}, + {'name': 'isnumeric', 'desc': ''' + Returns true if all the chars are numeric, false otherwise. + Unicode fractions are considered as numeric, but not decimals like `1.5`. + + Examples: + Test if string `123` only contains numeric chars:: + + $foo="123" return ( $foo.isnumeric() ) // true + ''', + 'type': {'type': 'function', '_funcname': '_methStrIsNumeric', + 'returns': {'type': 'bool', 'desc': 'Whether all chars are numeric', }}}, + {'name': 'isprintable', 'desc': ''' + Returns true if all the chars are printable, false otherwise. + + Examples: + Test if string `aca 123` only contains printable chars:: + + $foo="aca 123" return ( $foo.isprintable() ) // true + ''', + 'type': {'type': 'function', '_funcname': '_methStrIsPrintable', + 'returns': {'type': 'bool', 'desc': 'Whether all chars are printable', }}}, + {'name': 'isspace', 'desc': ''' + Returns true if all the chars are whitespaces, false otherwise. + + Examples: + Test if string ` ` only contains whitespaces:: + + $foo=" " return ( $foo.isspace() ) // true + ''', + 'type': {'type': 'function', '_funcname': '_methStrIsSpace', + 'returns': {'type': 'bool', 'desc': 'Whether all chars are whitespaces', }}}, + {'name': 'istitle', 'desc': ''' + Returns true if all words in a text start with a upper case letter and others are lower case, false otherwise. + + Examples: + Test if string `Aca Test` has words start with a upper case letter and others are lower case:: + + $foo="Aca Test" return ( $foo.istitle() ) // true + ''', + 'type': {'type': 'function', '_funcname': '_methStrIsTitle', + 'returns': {'type': 'bool', 'desc': 'Whether all words starts with an upper case', }}}, + {'name': 'isupper', 'desc': ''' + Returns true if all the characters are in upper case, false otherwise. + Numbers, symbols and spaces are not checked, only alphabet characters. + + Examples: + Test if string `ACA` only contains upper case chars:: + + $foo="ACA" return ( $foo.isupper() ) // true + ''', + 'type': {'type': 'function', '_funcname': '_methStrIsUpper', + 'returns': {'type': 'bool', 'desc': 'Whether all chars are upper case', }}}, ) _storm_typename = 'str' _ismutable = False @@ -4425,6 +4551,18 @@ def getObjLocals(self): 'reverse': self._methStrReverse, 'format': self._methStrFormat, 'json': self._methStrJson, + 'isalnum': self._methStrIsAlNum, + 'isalpha': self._methStrIsAlpha, + 'isascii': self._methStrIsASCII, + 'isdecimal': self._methStrIsDecimal, + 'isdigit': self._methStrIsDigit, + 'isidentifier': self._methStrIsIdentifier, + 'islower': self._methStrIsLower, + 'isnumeric': self._methStrIsNumeric, + 'isprintable': self._methStrIsPrintable, + 'isspace': self._methStrIsSpace, + 'istitle': self._methStrIsTitle, + 'isupper': self._methStrIsUpper } def __int__(self): @@ -4548,6 +4686,54 @@ async def _methStrJson(self): mesg = f'Text is not valid JSON: {self.valu}' raise s_exc.BadJsonText(mesg=mesg) + @stormfunc(readonly=True) + async def _methStrIsAlNum(self): + return self.valu.isalnum() + + @stormfunc(readonly=True) + async def _methStrIsAlpha(self): + return self.valu.isalpha() + + @stormfunc(readonly=True) + async def _methStrIsASCII(self): + return self.valu.isascii() + + @stormfunc(readonly=True) + async def _methStrIsDecimal(self): + return self.valu.isdecimal() + + @stormfunc(readonly=True) + async def _methStrIsDigit(self): + return self.valu.isdigit() + + @stormfunc(readonly=True) + async def _methStrIsIdentifier(self): + return self.valu.isidentifier() + + @stormfunc(readonly=True) + async def _methStrIsLower(self): + return self.valu.islower() + + @stormfunc(readonly=True) + async def _methStrIsNumeric(self): + return self.valu.isnumeric() + + @stormfunc(readonly=True) + async def _methStrIsPrintable(self): + return self.valu.isprintable() + + @stormfunc(readonly=True) + async def _methStrIsSpace(self): + return self.valu.isspace() + + @stormfunc(readonly=True) + async def _methStrIsTitle(self): + return self.valu.istitle() + + @stormfunc(readonly=True) + async def _methStrIsUpper(self): + return self.valu.isupper() + @registry.registerType class Bytes(Prim): ''' diff --git a/synapse/tests/test_lib_stormtypes.py b/synapse/tests/test_lib_stormtypes.py index c57c49c8f8..507374a2d4 100644 --- a/synapse/tests/test_lib_stormtypes.py +++ b/synapse/tests/test_lib_stormtypes.py @@ -1302,6 +1302,42 @@ async def test_storm_lib_str(self): q = '$foo="hehe {haha} {newp}" return ( $foo.format(haha=yup, baz=faz) )' self.eq('hehe yup {newp}', await core.callStorm(q)) + q = '$foo="aca123" return ( $foo.isalnum() )' + self.eq(True, await core.callStorm(q)) + + q = '$foo="aca" return ( $foo.isalpha() )' + self.eq(True, await core.callStorm(q)) + + q = '$foo="aca123!" return ( $foo.isascii() )' + self.eq(True, await core.callStorm(q)) + + q = '$foo="123" return ( $foo.isdecimal() )' + self.eq(True, await core.callStorm(q)) + + q = '$foo="123" return ( $foo.isdigit() )' + self.eq(True, await core.callStorm(q)) + + q = '$foo="aca_123" return ( $foo.isidentifier() )' + self.eq(True, await core.callStorm(q)) + + q = '$foo="aca" return ( $foo.islower() )' + self.eq(True, await core.callStorm(q)) + + q = '$foo="123" return ( $foo.isnumeric() )' + self.eq(True, await core.callStorm(q)) + + q = '$foo="aca" return ( $foo.isprintable() )' + self.eq(True, await core.callStorm(q)) + + q = '$foo=" " return ( $foo.isspace() )' + self.eq(True, await core.callStorm(q)) + + q = '$foo="Hello" return ( $foo.istitle() )' + self.eq(True, await core.callStorm(q)) + + q = '$foo="ACA" return ( $foo.isupper() )' + self.eq(True, await core.callStorm(q)) + # tuck the regx tests in with str self.true(await core.callStorm(r'''return($lib.regex.matches('^foo', foobar))''')) self.true(await core.callStorm(r'''return($lib.regex.matches('foo', FOOBAR, $lib.regex.flags.i))''')) From 4fbe89574e48e8efc300c5e36e901818201d0912 Mon Sep 17 00:00:00 2001 From: Antoine Cailliau Date: Fri, 12 Apr 2024 16:09:24 +0200 Subject: [PATCH 2/4] Updates based on the review --- synapse/lib/stormtypes.py | 24 ++++++++++++------------ synapse/tests/test_lib_stormtypes.py | 27 +++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/synapse/lib/stormtypes.py b/synapse/lib/stormtypes.py index edebd52d32..d31c0c2ee9 100644 --- a/synapse/lib/stormtypes.py +++ b/synapse/lib/stormtypes.py @@ -4551,18 +4551,18 @@ def getObjLocals(self): 'reverse': self._methStrReverse, 'format': self._methStrFormat, 'json': self._methStrJson, - 'isalnum': self._methStrIsAlNum, - 'isalpha': self._methStrIsAlpha, - 'isascii': self._methStrIsASCII, - 'isdecimal': self._methStrIsDecimal, - 'isdigit': self._methStrIsDigit, - 'isidentifier': self._methStrIsIdentifier, - 'islower': self._methStrIsLower, - 'isnumeric': self._methStrIsNumeric, - 'isprintable': self._methStrIsPrintable, - 'isspace': self._methStrIsSpace, - 'istitle': self._methStrIsTitle, - 'isupper': self._methStrIsUpper + 'isAlnum': self._methStrIsAlNum, + 'isAlpha': self._methStrIsAlpha, + 'isAscii': self._methStrIsASCII, + 'isDecimal': self._methStrIsDecimal, + 'isDigit': self._methStrIsDigit, + 'isIdentifier': self._methStrIsIdentifier, + 'isLower': self._methStrIsLower, + 'isNumeric': self._methStrIsNumeric, + 'isPrintable': self._methStrIsPrintable, + 'isSpace': self._methStrIsSpace, + 'isTitle': self._methStrIsTitle, + 'isUpper': self._methStrIsUpper, } def __int__(self): diff --git a/synapse/tests/test_lib_stormtypes.py b/synapse/tests/test_lib_stormtypes.py index 507374a2d4..ed4e6d36b6 100644 --- a/synapse/tests/test_lib_stormtypes.py +++ b/synapse/tests/test_lib_stormtypes.py @@ -1302,6 +1302,32 @@ async def test_storm_lib_str(self): q = '$foo="hehe {haha} {newp}" return ( $foo.format(haha=yup, baz=faz) )' self.eq('hehe yup {newp}', await core.callStorm(q)) +<<<<<<< HEAD + self.true(await core.callStorm('$foo="aca123" return ( $foo.isAlnum() )')) + self.false(await core.callStorm('$foo="$aca 123" return ( $foo.isAlnum() )')) + self.true(await core.callStorm('$foo="aca" return ( $foo.isAlpha() )')) + self.false(await core.callStorm('$foo="123" return ( $foo.isAlpha() )')) + self.true(await core.callStorm('$foo="aca123!" return ( $foo.isAscii() )')) + self.false(await core.callStorm('$foo="é" return ( $foo.isAscii() )')) + self.true(await core.callStorm('$foo="123" return ( $foo.isDecimal() )')) + self.false(await core.callStorm('$foo="a" return ( $foo.isDecimal() )')) + self.true(await core.callStorm('$foo="123" return ( $foo.isDigit() )')) + self.false(await core.callStorm('$foo="a" return ( $foo.isDigit() )')) + self.true(await core.callStorm('$foo="aca_123" return ( $foo.isIdentifier() )')) + self.false(await core.callStorm('$foo="aca 123" return ( $foo.isIdentifier() )')) + self.true(await core.callStorm('$foo="aca" return ( $foo.isLower() )')) + self.false(await core.callStorm('$foo="ACA" return ( $foo.isLower() )')) + self.true(await core.callStorm('$foo="123" return ( $foo.isNumeric() )')) + self.false(await core.callStorm('$foo="aca123" return ( $foo.isNumeric() )')) + self.true(await core.callStorm('$foo="aca" return ( $foo.isPrintable() )')) + self.false(await core.callStorm('$foo="\x0b" return ( $foo.isPrintable() )')) + self.true(await core.callStorm('$foo=" " return ( $foo.isSpace() )')) + self.false(await core.callStorm('$foo="not_a_space" return ( $foo.isSpace() )')) + self.true(await core.callStorm('$foo="Hello" return ( $foo.isTitle() )')) + self.false(await core.callStorm('$foo="hello" return ( $foo.isTitle() )')) + self.true(await core.callStorm('$foo="ACA" return ( $foo.isUpper() )')) + self.false(await core.callStorm('$foo="aca" return ( $foo.isUpper() )')) +======= q = '$foo="aca123" return ( $foo.isalnum() )' self.eq(True, await core.callStorm(q)) @@ -1337,6 +1363,7 @@ async def test_storm_lib_str(self): q = '$foo="ACA" return ( $foo.isupper() )' self.eq(True, await core.callStorm(q)) +>>>>>>> 6ba590f15 (Introduces is* methods for strings in storm lib) # tuck the regx tests in with str self.true(await core.callStorm(r'''return($lib.regex.matches('^foo', foobar))''')) From 9f0006afa7c0dd3f522ccfd31a4a0cddcb18c100 Mon Sep 17 00:00:00 2001 From: Antoine Cailliau Date: Fri, 12 Apr 2024 16:23:35 +0200 Subject: [PATCH 3/4] Fixes commit without file save --- synapse/tests/test_lib_stormtypes.py | 38 ---------------------------- 1 file changed, 38 deletions(-) diff --git a/synapse/tests/test_lib_stormtypes.py b/synapse/tests/test_lib_stormtypes.py index ed4e6d36b6..47104477aa 100644 --- a/synapse/tests/test_lib_stormtypes.py +++ b/synapse/tests/test_lib_stormtypes.py @@ -1302,7 +1302,6 @@ async def test_storm_lib_str(self): q = '$foo="hehe {haha} {newp}" return ( $foo.format(haha=yup, baz=faz) )' self.eq('hehe yup {newp}', await core.callStorm(q)) -<<<<<<< HEAD self.true(await core.callStorm('$foo="aca123" return ( $foo.isAlnum() )')) self.false(await core.callStorm('$foo="$aca 123" return ( $foo.isAlnum() )')) self.true(await core.callStorm('$foo="aca" return ( $foo.isAlpha() )')) @@ -1327,43 +1326,6 @@ async def test_storm_lib_str(self): self.false(await core.callStorm('$foo="hello" return ( $foo.isTitle() )')) self.true(await core.callStorm('$foo="ACA" return ( $foo.isUpper() )')) self.false(await core.callStorm('$foo="aca" return ( $foo.isUpper() )')) -======= - q = '$foo="aca123" return ( $foo.isalnum() )' - self.eq(True, await core.callStorm(q)) - - q = '$foo="aca" return ( $foo.isalpha() )' - self.eq(True, await core.callStorm(q)) - - q = '$foo="aca123!" return ( $foo.isascii() )' - self.eq(True, await core.callStorm(q)) - - q = '$foo="123" return ( $foo.isdecimal() )' - self.eq(True, await core.callStorm(q)) - - q = '$foo="123" return ( $foo.isdigit() )' - self.eq(True, await core.callStorm(q)) - - q = '$foo="aca_123" return ( $foo.isidentifier() )' - self.eq(True, await core.callStorm(q)) - - q = '$foo="aca" return ( $foo.islower() )' - self.eq(True, await core.callStorm(q)) - - q = '$foo="123" return ( $foo.isnumeric() )' - self.eq(True, await core.callStorm(q)) - - q = '$foo="aca" return ( $foo.isprintable() )' - self.eq(True, await core.callStorm(q)) - - q = '$foo=" " return ( $foo.isspace() )' - self.eq(True, await core.callStorm(q)) - - q = '$foo="Hello" return ( $foo.istitle() )' - self.eq(True, await core.callStorm(q)) - - q = '$foo="ACA" return ( $foo.isupper() )' - self.eq(True, await core.callStorm(q)) ->>>>>>> 6ba590f15 (Introduces is* methods for strings in storm lib) # tuck the regx tests in with str self.true(await core.callStorm(r'''return($lib.regex.matches('^foo', foobar))''')) From 1f8c470eb87911e9bea0a95a0ad2c55a3755071c Mon Sep 17 00:00:00 2001 From: Antoine Cailliau Date: Fri, 12 Apr 2024 17:49:14 +0200 Subject: [PATCH 4/4] Fixes casing issues --- synapse/lib/stormtypes.py | 48 +++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/synapse/lib/stormtypes.py b/synapse/lib/stormtypes.py index d31c0c2ee9..4d0352b117 100644 --- a/synapse/lib/stormtypes.py +++ b/synapse/lib/stormtypes.py @@ -4395,58 +4395,58 @@ class Str(Prim): {'name': 'json', 'desc': 'Parse a JSON string and return the deserialized data.', 'type': {'type': 'function', '_funcname': '_methStrJson', 'args': (), 'returns': {'type': 'prim', 'desc': 'The JSON deserialized object.', }}}, - {'name': 'isalnum', 'desc': ''' + {'name': 'isAlnum', 'desc': ''' Returns true if all chars in the string are alphanumeric, false otherwise. Examples: Test if string `aca123` is alphanumeric:: - $foo="aca123" return ( $foo.isalnum() ) // true + $foo="aca123" return ( $foo.isAlnum() ) // true ''', 'type': {'type': 'function', '_funcname': '_methStrIsAlnum', 'returns': {'type': 'bool', 'desc': 'Whether string is alphanumeric', }}}, - {'name': 'isalpha', 'desc': ''' + {'name': 'isAlpha', 'desc': ''' Returns true if all chars in the string are in the alphabet, false otherwise. Examples: Test if string `aca` contains only letters in the alphabet:: - $foo="aca" return ( $foo.isalpha() ) // true + $foo="aca" return ( $foo.isAlpha() ) // true ''', 'type': {'type': 'function', '_funcname': '_methStrIsAlpha', 'returns': {'type': 'bool', 'desc': 'Whether string only contains chars from alphabet', }}}, - {'name': 'isascii', 'desc': ''' + {'name': 'isAscii', 'desc': ''' Returns true if all chars in the string are ASCII chars, false otherwise. Examples: Test if string `aca` contains only letters in the alphabet:: - $foo="aca" return ( $foo.isascii() ) // true + $foo="aca" return ( $foo.isAscii() ) // true ''', 'type': {'type': 'function', '_funcname': '_methStrIsASCII', 'returns': {'type': 'bool', 'desc': 'Whether all the chars are ASCII', }}}, - {'name': 'isdecimal', 'desc': ''' + {'name': 'isDecimal', 'desc': ''' Returns true if all the chars are decimals (including unicode), false otherwise. Examples: Test if string `123` contains only decimals:: - $foo="123" return ( $foo.isdecimal() ) // true + $foo="123" return ( $foo.isDecimal() ) // true ''', 'type': {'type': 'function', '_funcname': '_methStrIsDecimal', 'returns': {'type': 'bool', 'desc': 'Whether all the chars are decimals', }}}, - {'name': 'isdigit', 'desc': ''' + {'name': 'isDigit', 'desc': ''' Returns true if all the chars are decimals, false otherwise. Exponents are considered as digits. Examples: Test if string `123` contains only digits:: - $foo="123" return ( $foo.isdigit() ) // true + $foo="123" return ( $foo.isDigit() ) // true ''', 'type': {'type': 'function', '_funcname': '_methStrIsDigit', 'returns': {'type': 'bool', 'desc': 'Whether all the chars are digits', }}}, - {'name': 'isidentifier', 'desc': ''' + {'name': 'isIdentifier', 'desc': ''' Returns true if the string is a valid identifier, false otherwise. A valid identifier only contains alphanumeric letters (a-z) and (0-9), or underscores (_). and cannot start with a number, or contain any spaces. @@ -4454,70 +4454,70 @@ class Str(Prim): Examples: Test if string `aca_123` is a valid identifier:: - $foo="aca_123" return ( $foo.isidentifier() ) // true + $foo="aca_123" return ( $foo.isIdentifier() ) // true ''', 'type': {'type': 'function', '_funcname': '_methStrIsIdentifier', 'returns': {'type': 'bool', 'desc': 'Whether the string is a valid identifier', }}}, - {'name': 'islower', 'desc': ''' + {'name': 'isLower', 'desc': ''' Returns true if all the chars are in lower case, false otherwise. Numbers, symbols and spaces are not checked, only alphabet characters. Examples: Test if string `aca` only contains lower case chars:: - $foo="aca" return ( $foo.islower() ) // true + $foo="aca" return ( $foo.isLower() ) // true ''', 'type': {'type': 'function', '_funcname': '_methStrIsLower', 'returns': {'type': 'bool', 'desc': 'Whether all chars are in lower case', }}}, - {'name': 'isnumeric', 'desc': ''' + {'name': 'isNumeric', 'desc': ''' Returns true if all the chars are numeric, false otherwise. Unicode fractions are considered as numeric, but not decimals like `1.5`. Examples: Test if string `123` only contains numeric chars:: - $foo="123" return ( $foo.isnumeric() ) // true + $foo="123" return ( $foo.isNumeric() ) // true ''', 'type': {'type': 'function', '_funcname': '_methStrIsNumeric', 'returns': {'type': 'bool', 'desc': 'Whether all chars are numeric', }}}, - {'name': 'isprintable', 'desc': ''' + {'name': 'isPrintable', 'desc': ''' Returns true if all the chars are printable, false otherwise. Examples: Test if string `aca 123` only contains printable chars:: - $foo="aca 123" return ( $foo.isprintable() ) // true + $foo="aca 123" return ( $foo.isPrintable() ) // true ''', 'type': {'type': 'function', '_funcname': '_methStrIsPrintable', 'returns': {'type': 'bool', 'desc': 'Whether all chars are printable', }}}, - {'name': 'isspace', 'desc': ''' + {'name': 'isSpace', 'desc': ''' Returns true if all the chars are whitespaces, false otherwise. Examples: Test if string ` ` only contains whitespaces:: - $foo=" " return ( $foo.isspace() ) // true + $foo=" " return ( $foo.isSpace() ) // true ''', 'type': {'type': 'function', '_funcname': '_methStrIsSpace', 'returns': {'type': 'bool', 'desc': 'Whether all chars are whitespaces', }}}, - {'name': 'istitle', 'desc': ''' + {'name': 'isTitle', 'desc': ''' Returns true if all words in a text start with a upper case letter and others are lower case, false otherwise. Examples: Test if string `Aca Test` has words start with a upper case letter and others are lower case:: - $foo="Aca Test" return ( $foo.istitle() ) // true + $foo="Aca Test" return ( $foo.isTitle() ) // true ''', 'type': {'type': 'function', '_funcname': '_methStrIsTitle', 'returns': {'type': 'bool', 'desc': 'Whether all words starts with an upper case', }}}, - {'name': 'isupper', 'desc': ''' + {'name': 'isUpper', 'desc': ''' Returns true if all the characters are in upper case, false otherwise. Numbers, symbols and spaces are not checked, only alphabet characters. Examples: Test if string `ACA` only contains upper case chars:: - $foo="ACA" return ( $foo.isupper() ) // true + $foo="ACA" return ( $foo.isUpper() ) // true ''', 'type': {'type': 'function', '_funcname': '_methStrIsUpper', 'returns': {'type': 'bool', 'desc': 'Whether all chars are upper case', }}},