Skip to content

Commit

Permalink
added the new need_reshape method to the ArabicReshaper and bumpe…
Browse files Browse the repository at this point in the history
…d version to "1.3.1".

using this new method you can check if a text need reshaping or not.
  • Loading branch information
YouKnow-sys committed Oct 31, 2023
1 parent 7ccd659 commit 39f0db1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ar-reshaper"
version = "1.3.0"
version = "1.3.1"
authors = ["Saeid Ghafari <saeid025@yahoo.com>"]
edition = "2021"
description = "Reconstruct Arabic sentences to be used in applications that don't support Arabic script."
Expand Down
8 changes: 8 additions & 0 deletions src/reshaper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ impl ArabicReshaper {
}
}

/// Check whatever the text need reshaping or not.
pub fn need_reshape<S>(&self, text: S) -> bool
where
S: AsRef<str>
{
text.as_ref().chars().any(|c| self.letters.contains_key(&c))
}

/// Reshape the given line and return the reshaped string
pub fn reshape<S>(&self, text: S) -> String
where
Expand Down

0 comments on commit 39f0db1

Please sign in to comment.