Class defining basic string conversion methods.
More...
Class defining basic string conversion methods.
◆ __init__()
def carputils.cml.cmlconverter.CMLConverter.__init__ |
( |
|
self | ) |
|
◆ convert()
def carputils.cml.cmlconverter.CMLConverter.convert |
( |
|
s | ) |
|
|
static |
Tries to convert a given string.
- Note
- This is just a method interface, a
NotImplementedError
will be raised when the method is called.
- Parameters
-
s | The string to be converted |
- Exceptions
-
◆ is_identifier()
def carputils.cml.cmlconverter.CMLConverter.is_identifier |
( |
|
s | ) |
|
|
static |
Checks whether the given string is a valid identifier or not.
- Parameters
-
s | The string to be checked |
- Returns
- True if the given object is a valid string, False otherwise
◆ is_valid_string()
def carputils.cml.cmlconverter.CMLConverter.is_valid_string |
( |
|
s | ) |
|
|
static |
Checks whether the given string is a valid string or not.
- Parameters
-
s | The string to be checked |
- Returns
- True if the given object is a valid string, False otherwise
◆ make_identifier()
def carputils.cml.cmlconverter.CMLConverter.make_identifier |
( |
|
s, |
|
|
|
substitute = '_' |
|
) |
| |
|
static |
Tries to convert the given string to a valid identifier.
- Parameters
-
s | The string to be converted |
substitute | A valid identifier string used to replace invalid characters in the s string |
- Returns
- The identifier string
- Exceptions
-
◆ to_float()
def carputils.cml.cmlconverter.CMLConverter.to_float |
( |
|
s | ) |
|
|
static |
Tries to convert a given string to a float.
- Parameters
-
s | The string to be converted |
- Returns
- A tuple (state, value) with
state ... The state of the conversion (True or False)
value ... The converted value (None if the state is False)
◆ to_int()
def carputils.cml.cmlconverter.CMLConverter.to_int |
( |
|
s | ) |
|
|
static |
Tries to convert a given string to an integer.
- Parameters
-
s | The string to be converted |
- Returns
- A tuple (state, value) with
state ... The state of the conversion (True or False) and
value ... the converted value (None if the state is False)
◆ to_string()
def carputils.cml.cmlconverter.CMLConverter.to_string |
( |
|
s | ) |
|
|
static |
Tries to convert a given string to a string.
- Parameters
-
s | The string to be converted |
- Returns
- A tuple (state, value) with
state ... The state of the conversion (True or False)
value ... The converted value (None if the state is False)
The documentation for this class was generated from the following file: