Returns the longest string with leading and trailing characters removed. If the characters are not specified, spaces are removed. btrim('xyxtrimyyx', 'xyz') = 'trim'
(args: &[ArrayRef])
| 32 | /// Returns the longest string with leading and trailing characters removed. If the characters are not specified, spaces are removed. |
| 33 | /// btrim('xyxtrimyyx', 'xyz') = 'trim' |
| 34 | fn btrim<T: OffsetSizeTrait>(args: &[ArrayRef]) -> Result<ArrayRef> { |
| 35 | let use_string_view = args[0].data_type() == &DataType::Utf8View; |
| 36 | let args = if args.len() > 1 { |
| 37 | let arg1 = arrow::compute::kernels::cast::cast(&args[1], args[0].data_type())?; |
| 38 | vec![Arc::clone(&args[0]), arg1] |
| 39 | } else { |
| 40 | args.to_owned() |
| 41 | }; |
| 42 | general_trim::<T, TrimBoth>(&args, use_string_view) |
| 43 | } |
| 44 | |
| 45 | #[user_doc( |
| 46 | doc_section(label = "String Functions"), |
searching dependent graphs…