feat: add find_ascii_non_printable function to identify non-printable ASCII characters
This commit is contained in:
parent
5653fa0708
commit
c955f92af9
@ -174,3 +174,4 @@ def quote(string: str, safe: str) -> str:
|
||||
"""
|
||||
|
||||
def unquote(value: str) -> str: ...
|
||||
def find_ascii_non_printable(s: str) -> typing.Optional[int]: ...
|
||||
|
||||
@ -71,6 +71,12 @@ pub fn quote(string: &str, safe: &str) -> String {
|
||||
result
|
||||
}
|
||||
|
||||
#[pyfunction]
|
||||
pub fn find_ascii_non_printable(s: &str) -> Option<usize> {
|
||||
s.chars()
|
||||
.position(|c| c.is_ascii() && !c.is_ascii_graphic() && c != ' ')
|
||||
}
|
||||
|
||||
pub(crate) trait PercentEncoded {
|
||||
fn percent_encoded(&self, safe: &str) -> String;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user