← 返回 stripe 的题目列表Key-Value Data Validation
类型:online_judge
Write a function to validate a given key-value dataset. The data is provided as a dictionary with multiple key-value pairs. The function should check if all values meet specific format requirements, such as integer types, string length limits, etc. Ensure the function can handle empty and invalid data, returning an error message if the data is not valid.
Input
A data dictionary data containing multiple key-value pairs, both keys and values are strings.
Output
Boolean indicating whether all data is valid; if not, return an error message.
Example
Input: {
"age": "25",
"name": "Alice",
"email": "alice@example.com"
}
Output: True
Input: {
"age": "25",
"name": "",
"email": "alice.com"
}
Output: "Invalid email format"
Example
Input
{"age": "25", "name": "Alice", "email": "alice@example.com"}