mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 15:32:23 -04:00
Trim the start of field name if it is #, /, ^ or a whitespace
I actually need to trim whitespace again to deal with a field name of the form "# foo"
This commit is contained in:
parent
ebc77985d8
commit
01caa3d996
1 changed files with 2 additions and 1 deletions
|
@ -42,7 +42,8 @@ impl NoteField {
|
|||
self.name = self.name.replace(bad_chars, "");
|
||||
}
|
||||
// and leading/trailing whitespace
|
||||
let trimmed = self.name.trim();
|
||||
let bad_start_chars = |c: char| c == '#' || c == '/' || c == '^' || c.is_whitespace();
|
||||
let trimmed = self.name.trim().trim_start_matches(bad_start_chars);
|
||||
if trimmed.len() != self.name.len() {
|
||||
self.name = trimmed.into();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue