Add a simple BOM striping feature for str
and String
.
rust
use str_strip_bom::*;
```rust
// Or std::fs::readtostring, surf::get, ...
let mystring: Vec
// In this time, mystring has the BOM => true 🍣 println!( "{} {}", mystring.startswith("\u{feff}"), &mystring );
// Strip BOM let mystring: &str = mystring.strip_bom();
// mystring (slice) has not the BOM => false 🍣 println!( "{} {}", mystring.startswith("\u{feff}"), &mystring ); ```
str
and String
, not for byte stream or the other of UTF-8 such as UTF-16 or UTF-32.serde
and serde_json
has no BOM supporting then it will be fail if I put a UTF-8 BOM source.str
and String
s will not support a BOM stripping features.; See also https://github.com/rust-lang/rfcs/issues/2428.