Helper method to convert value to string consistently
(&self, value: &Value)
| 275 | impl TrimFunction { |
| 276 | /// Helper method to convert value to string consistently |
| 277 | fn value_to_string(&self, value: &Value) -> FunctionResult<String> { |
| 278 | let string_val = if let Some(s) = value.as_string() { |
| 279 | s.to_string() |
| 280 | } else if let Some(n) = value.as_number() { |
| 281 | n.to_string() |
| 282 | } else { |
| 283 | match value { |
| 284 | Value::Boolean(b) => b.to_string(), |
| 285 | _ => return Ok(String::new()), // Return empty for non-convertible types |
| 286 | } |
| 287 | }; |
| 288 | Ok(string_val) |
| 289 | } |
| 290 | |
| 291 | /// Helper method to extract trim character from value |
| 292 | fn extract_trim_char(&self, value: &Value) -> FunctionResult<char> { |