pub struct QString { /* private fields */ }Expand description
Implementations§
Source§impl QString
impl QString
Sourcepub fn append<'a>(&'a mut self, str: &QString) -> &'a mut QString
pub fn append<'a>(&'a mut self, str: &QString) -> &'a mut QString
Appends the string str onto the end of this string.
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.
If cs is CaseSensitivity::CaseSensitive, the search is case-sensitive; otherwise the search is case-insensitive.
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.
If cs is CaseSensitivity::CaseSensitive, the search is case-sensitive; otherwise the search is case-insensitive.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the string has no characters; otherwise returns false.
Sourcepub fn is_lower(&self) -> bool
pub fn is_lower(&self) -> bool
Returns true if the string is lowercase, that is, it’s identical to its to_lower folding.
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.
Sourcepub fn is_upper(&self) -> bool
pub fn is_upper(&self) -> bool
Returns true if the string is uppercase, that is, it’s identical to its to_upper folding.
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.
Sourcepub fn prepend<'a>(&'a mut self, str: &QString) -> &'a mut QString
pub fn prepend<'a>(&'a mut self, str: &QString) -> &'a mut QString
Prepends the string str to the beginning of this string and returns a mutable reference to this string.
Sourcepub fn remove<'a>(
&'a mut self,
str: &QString,
cs: CaseSensitivity,
) -> &'a mut QString
pub fn remove<'a>( &'a mut self, str: &QString, cs: CaseSensitivity, ) -> &'a mut QString
Removes every occurrence of the given str string in this string, and returns a mutable reference to this string.
If cs is CaseSensitivity::CaseSensitive, the search is case-sensitive; otherwise the search is case-insensitive.
Sourcepub fn replace<'a>(
&'a mut self,
before: &QString,
after: &QString,
cs: CaseSensitivity,
) -> &'a mut QString
pub fn replace<'a>( &'a mut self, before: &QString, after: &QString, cs: CaseSensitivity, ) -> &'a mut QString
Replaces every occurrence of the string before with the string after and returns a mutable reference to this string.
If cs is CaseSensitivity::CaseSensitive, the search is case-sensitive; otherwise the search is case-insensitive.
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.
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.
If there is no unreplaced place-marker remaining, a warning message is printed and the result is undefined. Place-marker numbers must be in the range 1 to 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.
If cs is CaseSensitivity::CaseSensitive, the comparison is case-sensitive; otherwise the comparison is case-insensitive.
Case sensitive comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect.
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.
If cs is CaseSensitivity::CaseSensitive, the search is case-sensitive; otherwise the comparison is case-insensitive.
Sourcepub fn insert<'a>(&'a mut self, position: isize, str: &Self) -> &'a mut Self
pub fn insert<'a>(&'a mut self, position: 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.
Whitespace characters are the ASCII characters tabulation '\t', line feed '\n', carriage return '\r', vertical tabulation '\x08' ('\v' in C), form feed '\x0C' ('\f' in C), and 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, this function returns a single-element list containing this string.
cs specifies whether sep should be matched case sensitively or case insensitively.
If behavior is SplitBehaviorFlags::SkipEmptyParts, empty entries don’t appear in the result.
Sourcepub fn to_latin1(&self) -> QByteArray
pub fn to_latin1(&self) -> QByteArray
Returns a Latin-1 representation of the string as a QByteArray.
The returned byte array is undefined if the string contains non-Latin1 characters. Those characters may be suppressed or replaced with a question mark.
Sourcepub fn to_local8bit(&self) -> QByteArray
pub fn to_local8bit(&self) -> QByteArray
Returns the local 8-bit representation of the string as a QByteArray.
If this string contains any characters that cannot be encoded in the local 8-bit encoding, the returned byte array is undefined. Those characters may be suppressed or replaced by another.
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 this string.
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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de> Deserialize<'de> for QString
Available on crate feature serde only.
impl<'de> Deserialize<'de> for QString
serde only.Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
impl Eq for QString
Source§impl ExternType for QString
impl ExternType for QString
Source§impl<'a> From<&'a QString> for QAnyStringView<'a>
Available on cxxqt_qt_version_major=6 only.
impl<'a> From<&'a QString> for QAnyStringView<'a>
cxxqt_qt_version_major=6 only.Source§impl From<&QString> for QStringList
impl From<&QString> for QStringList
Source§impl From<&QString> for QUuid
impl From<&QString> for QUuid
Source§fn from(value: &QString) -> Self
fn from(value: &QString) -> Self
Creates a QUuid object from the string text, which must be formatted as five hex fields
separated by ‘-’, e.g., “{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}” where each ‘x’ is a hex
digit. The curly braces shown here are optional, but it is normal to include them.
If the conversion fails, a null UUID is returned.