#[repr(C)]pub struct QString { /* private fields */ }
Expand description
The QString class provides a Unicode character string.
Note that QString is a UTF-16 whereas Rust strings are a UTF-8
Implementations§
Source§impl QString
impl QString
Sourcepub fn contains(&self, str: &QString, cs: CaseSensitivity) -> bool
pub fn contains(&self, str: &QString, cs: CaseSensitivity) -> bool
Returns true if this string contains an occurrence of the string str; otherwise returns false.
Source§impl QString
impl QString
Sourcepub fn ends_with(&self, s: &QString, cs: CaseSensitivity) -> bool
pub fn ends_with(&self, s: &QString, cs: CaseSensitivity) -> bool
Returns true if the string ends with s; otherwise returns false.
Source§impl QString
impl QString
Sourcepub fn is_right_to_left(&self) -> bool
pub fn is_right_to_left(&self) -> bool
Returns true if the string is read right to left.
Source§impl QString
impl QString
Sourcepub fn is_valid_utf16(&self) -> bool
pub fn is_valid_utf16(&self) -> bool
Returns true if the string contains valid UTF-16 encoded data, or false otherwise.
Source§impl<'a> QString
impl<'a> QString
Sourcepub fn remove(
&'a mut self,
str: &QString,
cs: CaseSensitivity,
) -> &'a mut QString
pub fn remove( &'a mut self, str: &QString, cs: CaseSensitivity, ) -> &'a mut QString
Removes every occurrence of the given str string in this string, and returns a reference to this string.
Source§impl QString
impl QString
Sourcepub fn starts_with(&self, s: &QString, cs: CaseSensitivity) -> bool
pub fn starts_with(&self, s: &QString, cs: CaseSensitivity) -> bool
Returns true if the string starts with s; otherwise returns false.
Source§impl QString
impl QString
Sourcepub fn to_html_escaped(&self) -> QString
pub fn to_html_escaped(&self) -> QString
Converts a plain text string to an HTML string with HTML metacharacters <, >, &, and “ replaced by HTML entities.
Source§impl QString
impl QString
Sourcepub fn arg(&self, a: &QString) -> Self
pub fn arg(&self, a: &QString) -> Self
Returns a copy of this string with the lowest numbered place marker replaced by string a, i.e., %1, %2, …, %99.
Sourcepub fn compare(&self, other: &QString, cs: CaseSensitivity) -> Ordering
pub fn compare(&self, other: &QString, cs: CaseSensitivity) -> Ordering
Lexically compares this string with the other string and returns if this string is less than, equal to, or greater than the other string.
Sourcepub fn index_of(&self, str: &QString, from: isize, cs: CaseSensitivity) -> isize
pub fn index_of(&self, str: &QString, from: isize, cs: CaseSensitivity) -> isize
Returns the index position of the first occurrence of the string str in this string, searching forward from index position from. Returns -1 if str is not found.
Sourcepub fn insert<'a>(&'a mut self, pos: isize, str: &Self) -> &'a mut Self
pub fn insert<'a>(&'a mut self, pos: isize, str: &Self) -> &'a mut Self
Inserts the string str at the given index position and returns a mutable reference to this string.
Sourcepub fn left(&self, n: isize) -> Self
pub fn left(&self, n: isize) -> Self
Returns a substring that contains the n leftmost characters of the string.
Sourcepub fn mid(&self, position: isize, n: isize) -> Self
pub fn mid(&self, position: isize, n: isize) -> Self
Returns a string that contains n characters of this string, starting at the specified position index.
Sourcepub fn right(&self, n: isize) -> Self
pub fn right(&self, n: isize) -> Self
Returns a substring that contains the n rightmost characters of the string.
Sourcepub fn simplified(&self) -> Self
pub fn simplified(&self) -> Self
Returns a string that has whitespace removed from the start and the end, and that has each sequence of internal whitespace replaced with a single space.
Sourcepub fn split(
&self,
sep: &QString,
behavior: SplitBehaviorFlags,
cs: CaseSensitivity,
) -> QStringList
pub fn split( &self, sep: &QString, behavior: SplitBehaviorFlags, cs: CaseSensitivity, ) -> QStringList
Splits the string into substrings wherever sep occurs, and returns the list of those strings. If sep does not match anywhere in the string, split() returns a single-element list containing this string.
Sourcepub fn to_latin1(&self) -> QByteArray
pub fn to_latin1(&self) -> QByteArray
Returns a Latin-1 representation of the string as a QByteArray.
Sourcepub fn to_local8bit(&self) -> QByteArray
pub fn to_local8bit(&self) -> QByteArray
Returns the local 8-bit representation of the string as a QByteArray. The returned byte array is undefined if the string contains characters not supported by the local 8-bit encoding.
Sourcepub fn to_utf8(&self) -> QByteArray
pub fn to_utf8(&self) -> QByteArray
Returns a UTF-8 representation of the string as a QByteArray.
Trait Implementations§
Source§impl Clone for QString
impl Clone for QString
Source§fn clone(&self) -> Self
fn clone(&self) -> Self
Constructs a copy of other.
This operation takes constant time, because QString is implicitly shared. This makes returning a QString from a function very fast. If a shared instance is modified, it will be copied (copy-on-write), and that takes linear time.
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more