Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > 1dd17e0d683ef79b4bb6872bbf359d7f > files > 6477

qt4-doc-4.8.7-26.2.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qstring.cpp -->
  <title>Qt 4.8: QString Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <div class="breadcrumb toolblock">
            <ul>
              <li class="first"><a href="index.html">Home</a></li>
              <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtcore.html">QtCore</a></li>
<li>QString</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></li>
            </ul>
        </div>
        </div>
        <div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#related-non-members">Related Non-Members</a></li>
<li class="level1"><a href="#macros">Macros</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#initializing-a-string">Initializing a String</a></li>
<li class="level2"><a href="#manipulating-string-data">Manipulating String Data</a></li>
<li class="level2"><a href="#querying-string-data">Querying String Data</a></li>
<li class="level2"><a href="#converting-between-8-bit-strings-and-unicode-strings">Converting Between 8-Bit Strings and Unicode Strings</a></li>
<li class="level2"><a href="#distinction-between-null-and-empty-strings">Distinction Between Null and Empty Strings</a></li>
<li class="level2"><a href="#argument-formats">Argument Formats</a></li>
<li class="level2"><a href="#more-efficient-string-construction">More Efficient String Construction</a></li>
</ul>
</div>
<h1 class="title">QString Class Reference</h1>
<!-- $$$QString-brief -->
<p>The QString class provides a Unicode character string. <a href="#details">More...</a></p>
<!-- @@@QString -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QString&gt;</span></pre><p><b>Inherited by: </b><a href="qconststring.html" class="compat">QConstString</a>, <a href="qdbusobjectpath.html">QDBusObjectPath</a>, and <a href="qdbussignature.html">QDBusSignature</a>.</p>
<p><b>Note:</b> All functions in this class are <a href="threads-reentrancy.html#reentrant">reentrant</a>, except for <a href="qstring-qt3.html#ascii" class="compat">ascii</a>(), <a href="qstring-qt3.html#latin1" class="compat">latin1</a>(), <a href="qstring-qt3.html#utf8" class="compat">utf8</a>(), and <a href="qstring-qt3.html#local8Bit" class="compat">local8Bit</a>(), which are nonreentrant.</p>
<ul>
<li><a href="qstring-members.html">List of all members, including inherited members</a></li>
<li><a href="qstring-qt3.html">Qt 3 support members</a></li>
</ul>
<a name="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> class </td><td class="memItemRight bottomAlign"><b><a href="qstring-null.html">Null</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#ConstIterator-typedef">ConstIterator</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#Iterator-typedef">Iterator</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#NormalizationForm-enum">NormalizationForm</a></b> { NormalizationForm_D, NormalizationForm_C, NormalizationForm_KD, NormalizationForm_KC }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#SectionFlag-enum">SectionFlag</a></b> { SectionDefault, SectionSkipEmpty, SectionIncludeLeadingSep, SectionIncludeTrailingSep, SectionCaseInsensitiveSeps }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> flags </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#SectionFlag-enum">SectionFlags</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#SplitBehavior-enum">SplitBehavior</a></b> { KeepEmptyParts, SkipEmptyParts }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#const_iterator-typedef">const_iterator</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#const_reference-typedef">const_reference</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#iterator-typedefx">iterator</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#reference-typedef">reference</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#value_type-typedef">value_type</a></b></td></tr>
</table>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#QString">QString</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#QString-2">QString</a></b> ( const QChar * <i>unicode</i>, int <i>size</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#QString-3">QString</a></b> ( const QChar * <i>unicode</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#QString-4">QString</a></b> ( QChar <i>ch</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#QString-5">QString</a></b> ( int <i>size</i>, QChar <i>ch</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#QString-6">QString</a></b> ( const QLatin1String &amp; <i>str</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#QString-7">QString</a></b> ( const QString &amp; <i>other</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#QString-8">QString</a></b> ( const char * <i>str</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#QString-9">QString</a></b> ( const QByteArray &amp; <i>ba</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#dtor.QString">~QString</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#append">append</a></b> ( const QString &amp; <i>str</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#append-2">append</a></b> ( const QStringRef &amp; <i>reference</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#append-3">append</a></b> ( const QLatin1String &amp; <i>str</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#append-4">append</a></b> ( const QByteArray &amp; <i>ba</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#append-5">append</a></b> ( const char * <i>str</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#append-6">append</a></b> ( QChar <i>ch</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#arg">arg</a></b> ( const QString &amp; <i>a</i>, int <i>fieldWidth</i> = 0, const QChar &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#arg-2">arg</a></b> ( const QString &amp; <i>a1</i>, const QString &amp; <i>a2</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#arg-3">arg</a></b> ( const QString &amp; <i>a1</i>, const QString &amp; <i>a2</i>, const QString &amp; <i>a3</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#arg-4">arg</a></b> ( const QString &amp; <i>a1</i>, const QString &amp; <i>a2</i>, const QString &amp; <i>a3</i>, const QString &amp; <i>a4</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#arg-5">arg</a></b> ( const QString &amp; <i>a1</i>, const QString &amp; <i>a2</i>, const QString &amp; <i>a3</i>, const QString &amp; <i>a4</i>, const QString &amp; <i>a5</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#arg-6">arg</a></b> ( const QString &amp; <i>a1</i>, const QString &amp; <i>a2</i>, const QString &amp; <i>a3</i>, const QString &amp; <i>a4</i>, const QString &amp; <i>a5</i>, const QString &amp; <i>a6</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#arg-7">arg</a></b> ( const QString &amp; <i>a1</i>, const QString &amp; <i>a2</i>, const QString &amp; <i>a3</i>, const QString &amp; <i>a4</i>, const QString &amp; <i>a5</i>, const QString &amp; <i>a6</i>, const QString &amp; <i>a7</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#arg-8">arg</a></b> ( const QString &amp; <i>a1</i>, const QString &amp; <i>a2</i>, const QString &amp; <i>a3</i>, const QString &amp; <i>a4</i>, const QString &amp; <i>a5</i>, const QString &amp; <i>a6</i>, const QString &amp; <i>a7</i>, const QString &amp; <i>a8</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#arg-9">arg</a></b> ( const QString &amp; <i>a1</i>, const QString &amp; <i>a2</i>, const QString &amp; <i>a3</i>, const QString &amp; <i>a4</i>, const QString &amp; <i>a5</i>, const QString &amp; <i>a6</i>, const QString &amp; <i>a7</i>, const QString &amp; <i>a8</i>, const QString &amp; <i>a9</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#arg-10">arg</a></b> ( int <i>a</i>, int <i>fieldWidth</i> = 0, int <i>base</i> = 10, const QChar &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#arg-11">arg</a></b> ( uint <i>a</i>, int <i>fieldWidth</i> = 0, int <i>base</i> = 10, const QChar &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#arg-12">arg</a></b> ( long <i>a</i>, int <i>fieldWidth</i> = 0, int <i>base</i> = 10, const QChar &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#arg-13">arg</a></b> ( ulong <i>a</i>, int <i>fieldWidth</i> = 0, int <i>base</i> = 10, const QChar &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#arg-14">arg</a></b> ( qlonglong <i>a</i>, int <i>fieldWidth</i> = 0, int <i>base</i> = 10, const QChar &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#arg-15">arg</a></b> ( qulonglong <i>a</i>, int <i>fieldWidth</i> = 0, int <i>base</i> = 10, const QChar &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#arg-16">arg</a></b> ( short <i>a</i>, int <i>fieldWidth</i> = 0, int <i>base</i> = 10, const QChar &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#arg-17">arg</a></b> ( ushort <i>a</i>, int <i>fieldWidth</i> = 0, int <i>base</i> = 10, const QChar &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#arg-18">arg</a></b> ( QChar <i>a</i>, int <i>fieldWidth</i> = 0, const QChar &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#arg-19">arg</a></b> ( char <i>a</i>, int <i>fieldWidth</i> = 0, const QChar &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#arg-20">arg</a></b> ( double <i>a</i>, int <i>fieldWidth</i> = 0, char <i>format</i> = 'g', int <i>precision</i> = -1, const QChar &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QChar </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#at">at</a></b> ( int <i>position</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> iterator </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#begin">begin</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const_iterator </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#begin-2">begin</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#capacity">capacity</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#chop">chop</a></b> ( int <i>n</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#clear">clear</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#compare-5">compare</a></b> ( const QString &amp; <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#compare-6">compare</a></b> ( const QString &amp; <i>other</i>, Qt::CaseSensitivity <i>cs</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#compare-7">compare</a></b> ( const QLatin1String &amp; <i>other</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#compare-8">compare</a></b> ( const QStringRef &amp; <i>ref</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const_iterator </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#constBegin">constBegin</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QChar * </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#constData">constData</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const_iterator </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#constEnd">constEnd</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#contains">contains</a></b> ( const QString &amp; <i>str</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#contains-2">contains</a></b> ( const QStringRef &amp; <i>str</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#contains-5">contains</a></b> ( QChar <i>ch</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#contains-6">contains</a></b> ( const QRegExp &amp; <i>rx</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#contains-7">contains</a></b> ( QRegExp &amp; <i>rx</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#count">count</a></b> ( const QString &amp; <i>str</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#count-2">count</a></b> ( QChar <i>ch</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#count-3">count</a></b> ( const QStringRef &amp; <i>str</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#count-4">count</a></b> ( const QRegExp &amp; <i>rx</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#count-5">count</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QChar * </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#data">data</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QChar * </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#data-2">data</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> iterator </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#end">end</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const_iterator </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#end-2">end</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#endsWith">endsWith</a></b> ( const QString &amp; <i>s</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#endsWith-3">endsWith</a></b> ( const QStringRef &amp; <i>s</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#endsWith-4">endsWith</a></b> ( const QLatin1String &amp; <i>s</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#endsWith-5">endsWith</a></b> ( const QChar &amp; <i>c</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#fill">fill</a></b> ( QChar <i>ch</i>, int <i>size</i> = -1 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#indexOf">indexOf</a></b> ( const QString &amp; <i>str</i>, int <i>from</i> = 0, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#indexOf-2">indexOf</a></b> ( const QLatin1String &amp; <i>str</i>, int <i>from</i> = 0, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#indexOf-3">indexOf</a></b> ( QChar <i>ch</i>, int <i>from</i> = 0, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#indexOf-4">indexOf</a></b> ( const QStringRef &amp; <i>str</i>, int <i>from</i> = 0, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#indexOf-5">indexOf</a></b> ( const QRegExp &amp; <i>rx</i>, int <i>from</i> = 0 ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#indexOf-6">indexOf</a></b> ( QRegExp &amp; <i>rx</i>, int <i>from</i> = 0 ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#insert">insert</a></b> ( int <i>position</i>, const QString &amp; <i>str</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#insert-2">insert</a></b> ( int <i>position</i>, const QLatin1String &amp; <i>str</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#insert-3">insert</a></b> ( int <i>position</i>, const QChar * <i>unicode</i>, int <i>size</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#insert-4">insert</a></b> ( int <i>position</i>, QChar <i>ch</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#isEmpty">isEmpty</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#isNull">isNull</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#isRightToLeft">isRightToLeft</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#lastIndexOf">lastIndexOf</a></b> ( const QString &amp; <i>str</i>, int <i>from</i> = -1, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#lastIndexOf-2">lastIndexOf</a></b> ( const QLatin1String &amp; <i>str</i>, int <i>from</i> = -1, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#lastIndexOf-3">lastIndexOf</a></b> ( QChar <i>ch</i>, int <i>from</i> = -1, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#lastIndexOf-4">lastIndexOf</a></b> ( const QStringRef &amp; <i>str</i>, int <i>from</i> = -1, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#lastIndexOf-5">lastIndexOf</a></b> ( const QRegExp &amp; <i>rx</i>, int <i>from</i> = -1 ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#lastIndexOf-6">lastIndexOf</a></b> ( QRegExp &amp; <i>rx</i>, int <i>from</i> = -1 ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#left">left</a></b> ( int <i>n</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#leftJustified">leftJustified</a></b> ( int <i>width</i>, QChar <i>fill</i> = QLatin1Char( ' ' ), bool <i>truncate</i> = false ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringRef </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#leftRef">leftRef</a></b> ( int <i>n</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#length">length</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#localeAwareCompare-2">localeAwareCompare</a></b> ( const QStringRef &amp; <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#localeAwareCompare-4">localeAwareCompare</a></b> ( const QString &amp; <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#mid">mid</a></b> ( int <i>position</i>, int <i>n</i> = -1 ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringRef </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#midRef">midRef</a></b> ( int <i>position</i>, int <i>n</i> = -1 ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#normalized">normalized</a></b> ( NormalizationForm <i>mode</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#normalized-2">normalized</a></b> ( NormalizationForm <i>mode</i>, QChar::UnicodeVersion <i>version</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#prepend">prepend</a></b> ( const QString &amp; <i>str</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#prepend-2">prepend</a></b> ( const QLatin1String &amp; <i>str</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#prepend-3">prepend</a></b> ( const QByteArray &amp; <i>ba</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#prepend-4">prepend</a></b> ( const char * <i>str</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#prepend-5">prepend</a></b> ( QChar <i>ch</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#push_back">push_back</a></b> ( const QString &amp; <i>other</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#push_back-2">push_back</a></b> ( QChar <i>ch</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#push_front">push_front</a></b> ( const QString &amp; <i>other</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#push_front-2">push_front</a></b> ( QChar <i>ch</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#remove">remove</a></b> ( int <i>position</i>, int <i>n</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#remove-2">remove</a></b> ( QChar <i>ch</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#remove-3">remove</a></b> ( const QString &amp; <i>str</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#remove-4">remove</a></b> ( const QRegExp &amp; <i>rx</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#repeated">repeated</a></b> ( int <i>times</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#replace">replace</a></b> ( int <i>position</i>, int <i>n</i>, const QString &amp; <i>after</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#replace-6">replace</a></b> ( int <i>position</i>, int <i>n</i>, const QChar * <i>unicode</i>, int <i>size</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#replace-7">replace</a></b> ( int <i>position</i>, int <i>n</i>, QChar <i>after</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#replace-8">replace</a></b> ( const QString &amp; <i>before</i>, const QString &amp; <i>after</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#replace-9">replace</a></b> ( const QChar * <i>before</i>, int <i>blen</i>, const QChar * <i>after</i>, int <i>alen</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#replace-10">replace</a></b> ( QChar <i>ch</i>, const QString &amp; <i>after</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#replace-11">replace</a></b> ( QChar <i>before</i>, QChar <i>after</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#replace-12">replace</a></b> ( const QLatin1String &amp; <i>before</i>, const QLatin1String &amp; <i>after</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#replace-13">replace</a></b> ( const QLatin1String &amp; <i>before</i>, const QString &amp; <i>after</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#replace-14">replace</a></b> ( const QString &amp; <i>before</i>, const QLatin1String &amp; <i>after</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#replace-15">replace</a></b> ( QChar <i>c</i>, const QLatin1String &amp; <i>after</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#replace-16">replace</a></b> ( const QRegExp &amp; <i>rx</i>, const QString &amp; <i>after</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#reserve">reserve</a></b> ( int <i>size</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#resize">resize</a></b> ( int <i>size</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#right">right</a></b> ( int <i>n</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#rightJustified">rightJustified</a></b> ( int <i>width</i>, QChar <i>fill</i> = QLatin1Char( ' ' ), bool <i>truncate</i> = false ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringRef </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#rightRef">rightRef</a></b> ( int <i>n</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#section">section</a></b> ( QChar <i>sep</i>, int <i>start</i>, int <i>end</i> = -1, SectionFlags <i>flags</i> = SectionDefault ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#section-2">section</a></b> ( const QString &amp; <i>sep</i>, int <i>start</i>, int <i>end</i> = -1, SectionFlags <i>flags</i> = SectionDefault ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#section-3">section</a></b> ( const QRegExp &amp; <i>reg</i>, int <i>start</i>, int <i>end</i> = -1, SectionFlags <i>flags</i> = SectionDefault ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#setNum">setNum</a></b> ( int <i>n</i>, int <i>base</i> = 10 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#setNum-2">setNum</a></b> ( uint <i>n</i>, int <i>base</i> = 10 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#setNum-3">setNum</a></b> ( long <i>n</i>, int <i>base</i> = 10 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#setNum-4">setNum</a></b> ( ulong <i>n</i>, int <i>base</i> = 10 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#setNum-5">setNum</a></b> ( qlonglong <i>n</i>, int <i>base</i> = 10 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#setNum-6">setNum</a></b> ( qulonglong <i>n</i>, int <i>base</i> = 10 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#setNum-7">setNum</a></b> ( short <i>n</i>, int <i>base</i> = 10 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#setNum-8">setNum</a></b> ( ushort <i>n</i>, int <i>base</i> = 10 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#setNum-9">setNum</a></b> ( double <i>n</i>, char <i>format</i> = 'g', int <i>precision</i> = 6 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#setNum-10">setNum</a></b> ( float <i>n</i>, char <i>format</i> = 'g', int <i>precision</i> = 6 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#setRawData">setRawData</a></b> ( const QChar * <i>unicode</i>, int <i>size</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#setUnicode">setUnicode</a></b> ( const QChar * <i>unicode</i>, int <i>size</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#setUtf16">setUtf16</a></b> ( const ushort * <i>unicode</i>, int <i>size</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#simplified">simplified</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#size">size</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#split">split</a></b> ( const QString &amp; <i>sep</i>, SplitBehavior <i>behavior</i> = KeepEmptyParts, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#split-2">split</a></b> ( const QChar &amp; <i>sep</i>, SplitBehavior <i>behavior</i> = KeepEmptyParts, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#split-3">split</a></b> ( const QRegExp &amp; <i>rx</i>, SplitBehavior <i>behavior</i> = KeepEmptyParts ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#sprintf">sprintf</a></b> ( const char * <i>cformat</i>, ... )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#squeeze">squeeze</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#startsWith">startsWith</a></b> ( const QString &amp; <i>s</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#startsWith-3">startsWith</a></b> ( const QLatin1String &amp; <i>s</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#startsWith-4">startsWith</a></b> ( const QChar &amp; <i>c</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#startsWith-5">startsWith</a></b> ( const QStringRef &amp; <i>s</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#swap">swap</a></b> ( QString &amp; <i>other</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#toAscii">toAscii</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#toCaseFolded">toCaseFolded</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> double </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#toDouble">toDouble</a></b> ( bool * <i>ok</i> = 0 ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> float </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#toFloat">toFloat</a></b> ( bool * <i>ok</i> = 0 ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#toInt">toInt</a></b> ( bool * <i>ok</i> = 0, int <i>base</i> = 10 ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#toLatin1">toLatin1</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#toLocal8Bit">toLocal8Bit</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> long </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#toLong">toLong</a></b> ( bool * <i>ok</i> = 0, int <i>base</i> = 10 ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qlonglong </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#toLongLong">toLongLong</a></b> ( bool * <i>ok</i> = 0, int <i>base</i> = 10 ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#toLower">toLower</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> short </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#toShort">toShort</a></b> ( bool * <i>ok</i> = 0, int <i>base</i> = 10 ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> std::string </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#toStdString">toStdString</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> std::wstring </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#toStdWString">toStdWString</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> uint </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#toUInt">toUInt</a></b> ( bool * <i>ok</i> = 0, int <i>base</i> = 10 ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> ulong </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#toULong">toULong</a></b> ( bool * <i>ok</i> = 0, int <i>base</i> = 10 ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qulonglong </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#toULongLong">toULongLong</a></b> ( bool * <i>ok</i> = 0, int <i>base</i> = 10 ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> ushort </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#toUShort">toUShort</a></b> ( bool * <i>ok</i> = 0, int <i>base</i> = 10 ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QVector&lt;uint&gt; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#toUcs4">toUcs4</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#toUpper">toUpper</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#toUtf8">toUtf8</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#toWCharArray">toWCharArray</a></b> ( wchar_t * <i>array</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#trimmed">trimmed</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#truncate">truncate</a></b> ( int <i>position</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QChar * </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#unicode">unicode</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const ushort * </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#utf16">utf16</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#vsprintf">vsprintf</a></b> ( const char * <i>cformat</i>, va_list <i>ap</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-not-eq">operator!=</a></b> ( const QString &amp; <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-not-eq-2">operator!=</a></b> ( const QLatin1String &amp; <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-not-eq-3">operator!=</a></b> ( const QByteArray &amp; <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-not-eq-4">operator!=</a></b> ( const char * <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-2b-eq">operator+=</a></b> ( const QString &amp; <i>other</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-2b-eq-2">operator+=</a></b> ( const QLatin1String &amp; <i>str</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-2b-eq-3">operator+=</a></b> ( const QByteArray &amp; <i>ba</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-2b-eq-4">operator+=</a></b> ( const char * <i>str</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-2b-eq-5">operator+=</a></b> ( const QStringRef &amp; <i>str</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-2b-eq-6">operator+=</a></b> ( char <i>ch</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-2b-eq-7">operator+=</a></b> ( QChar <i>ch</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-lt">operator&lt;</a></b> ( const QString &amp; <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-lt-2">operator&lt;</a></b> ( const QLatin1String &amp; <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-lt-3">operator&lt;</a></b> ( const QByteArray &amp; <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-lt-4">operator&lt;</a></b> ( const char * <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-lt-eq">operator&lt;=</a></b> ( const QString &amp; <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-lt-eq-2">operator&lt;=</a></b> ( const QLatin1String &amp; <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-lt-eq-3">operator&lt;=</a></b> ( const QByteArray &amp; <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-lt-eq-4">operator&lt;=</a></b> ( const char * <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-eq">operator=</a></b> ( const QString &amp; <i>other</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-eq-3">operator=</a></b> ( const QLatin1String &amp; <i>str</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-eq-4">operator=</a></b> ( const QByteArray &amp; <i>ba</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-eq-5">operator=</a></b> ( const char * <i>str</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-eq-6">operator=</a></b> ( char <i>ch</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-eq-7">operator=</a></b> ( QChar <i>ch</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-eq-eq">operator==</a></b> ( const QString &amp; <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-eq-eq-2">operator==</a></b> ( const QLatin1String &amp; <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-eq-eq-3">operator==</a></b> ( const QByteArray &amp; <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-eq-eq-4">operator==</a></b> ( const char * <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-gt">operator&gt;</a></b> ( const QString &amp; <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-gt-2">operator&gt;</a></b> ( const QLatin1String &amp; <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-gt-3">operator&gt;</a></b> ( const QByteArray &amp; <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-gt-4">operator&gt;</a></b> ( const char * <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-gt-eq">operator&gt;=</a></b> ( const QString &amp; <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-gt-eq-2">operator&gt;=</a></b> ( const QLatin1String &amp; <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-gt-eq-3">operator&gt;=</a></b> ( const QByteArray &amp; <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-gt-eq-4">operator&gt;=</a></b> ( const char * <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QCharRef </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-5b-5d">operator[]</a></b> ( int <i>position</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QChar </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-5b-5d-2">operator[]</a></b> ( int <i>position</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QCharRef </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-5b-5d-3">operator[]</a></b> ( uint <i>position</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QChar </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-5b-5d-4">operator[]</a></b> ( uint <i>position</i> ) const</td></tr>
</table>
<a name="static-public-members"></a>
<h2>Static Public Members</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#compare">compare</a></b> ( const QString &amp; <i>s1</i>, const QString &amp; <i>s2</i>, Qt::CaseSensitivity <i>cs</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#compare-2">compare</a></b> ( const QString &amp; <i>s1</i>, const QString &amp; <i>s2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#compare-3">compare</a></b> ( const QString &amp; <i>s1</i>, const QLatin1String &amp; <i>s2</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#compare-4">compare</a></b> ( const QLatin1String &amp; <i>s1</i>, const QString &amp; <i>s2</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#compare-9">compare</a></b> ( const QString &amp; <i>s1</i>, const QStringRef &amp; <i>s2</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#fromAscii">fromAscii</a></b> ( const char * <i>str</i>, int <i>size</i> = -1 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#fromLatin1">fromLatin1</a></b> ( const char * <i>str</i>, int <i>size</i> = -1 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#fromLocal8Bit">fromLocal8Bit</a></b> ( const char * <i>str</i>, int <i>size</i> = -1 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#fromRawData">fromRawData</a></b> ( const QChar * <i>unicode</i>, int <i>size</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#fromStdString">fromStdString</a></b> ( const std::string &amp; <i>str</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#fromStdWString">fromStdWString</a></b> ( const std::wstring &amp; <i>str</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#fromUcs4">fromUcs4</a></b> ( const uint * <i>unicode</i>, int <i>size</i> = -1 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#fromUtf8">fromUtf8</a></b> ( const char * <i>str</i>, int <i>size</i> = -1 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#fromUtf16">fromUtf16</a></b> ( const ushort * <i>unicode</i>, int <i>size</i> = -1 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#fromWCharArray">fromWCharArray</a></b> ( const wchar_t * <i>string</i>, int <i>size</i> = -1 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#localeAwareCompare">localeAwareCompare</a></b> ( const QString &amp; <i>s1</i>, const QString &amp; <i>s2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#localeAwareCompare-3">localeAwareCompare</a></b> ( const QString &amp; <i>s1</i>, const QStringRef &amp; <i>s2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#number">number</a></b> ( long <i>n</i>, int <i>base</i> = 10 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#number-2">number</a></b> ( double <i>n</i>, char <i>format</i> = 'g', int <i>precision</i> = 6 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#number-3">number</a></b> ( ulong <i>n</i>, int <i>base</i> = 10 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#number-4">number</a></b> ( int <i>n</i>, int <i>base</i> = 10 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#number-5">number</a></b> ( uint <i>n</i>, int <i>base</i> = 10 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#number-6">number</a></b> ( qlonglong <i>n</i>, int <i>base</i> = 10 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#number-7">number</a></b> ( qulonglong <i>n</i>, int <i>base</i> = 10 )</td></tr>
</table>
<a name="related-non-members"></a>
<h2>Related Non-Members</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-not-eq-10">operator!=</a></b> ( const char * <i>s1</i>, const QString &amp; <i>s2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-2b-3">operator+</a></b> ( const QString &amp; <i>s1</i>, const QString &amp; <i>s2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-2b-6">operator+</a></b> ( const QString &amp; <i>s1</i>, const char * <i>s2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-2b-7">operator+</a></b> ( const char * <i>s1</i>, const QString &amp; <i>s2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-2b-8">operator+</a></b> ( char <i>ch</i>, const QString &amp; <i>s</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QString </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-2b-9">operator+</a></b> ( const QString &amp; <i>s</i>, char <i>ch</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-lt-3">operator&lt;</a></b> ( const char * <i>s1</i>, const QString &amp; <i>s2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-lt-lt-29">operator&lt;&lt;</a></b> ( QDataStream &amp; <i>stream</i>, const QString &amp; <i>string</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-lt-eq-3">operator&lt;=</a></b> ( const char * <i>s1</i>, const QString &amp; <i>s2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-eq-eq-98">operator==</a></b> ( const char * <i>s1</i>, const QString &amp; <i>s2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-gt-3">operator&gt;</a></b> ( const char * <i>s1</i>, const QString &amp; <i>s2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-gt-eq-3">operator&gt;=</a></b> ( const char * <i>s1</i>, const QString &amp; <i>s2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream &amp; </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#operator-gt-gt-18">operator&gt;&gt;</a></b> ( QDataStream &amp; <i>stream</i>, QString &amp; <i>string</i> )</td></tr>
</table>
<a name="macros"></a>
<h2>Macros</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#QT_NO_CAST_FROM_ASCII">QT_NO_CAST_FROM_ASCII</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstring.html#QT_NO_CAST_TO_ASCII">QT_NO_CAST_TO_ASCII</a></b></td></tr>
</table>
<a name="details"></a>
<!-- $$$QString-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QString class provides a Unicode character string.</p>
<p>QString stores a string of 16-bit <a href="qchar.html">QChar</a>s, where each <a href="qchar.html">QChar</a> corresponds one Unicode 4.0 character. (Unicode characters with code values above 65535 are stored using surrogate pairs, i.e&#x2e;, two consecutive <a href="qchar.html">QChar</a>s.)</p>
<p><a href="unicode.html#unicode">Unicode</a> is an international standard that supports most of the writing systems in use today. It is a superset of US-ASCII (ANSI X3.4-1986) and Latin-1 (ISO 8859-1), and all the US-ASCII/Latin-1 characters are available at the same code positions.</p>
<p>Behind the scenes, QString uses <a href="implicit-sharing.html">implicit sharing</a> (copy-on-write) to reduce memory usage and to avoid the needless copying of data. This also helps reduce the inherent overhead of storing 16-bit characters instead of 8-bit characters.</p>
<p>In addition to QString, Qt also provides the <a href="qbytearray.html">QByteArray</a> class to store raw bytes and traditional 8-bit '\0'-terminated strings. For most purposes, QString is the class you want to use. It is used throughout the Qt API, and the Unicode support ensures that your applications will be easy to translate if you want to expand your application's market at some point. The two main cases where <a href="qbytearray.html">QByteArray</a> is appropriate are when you need to store raw binary data, and when memory conservation is critical (e.g&#x2e;, with <a href="qt-embedded-linux.html">Qt for Embedded Linux</a>).</p>
<a name="initializing-a-string"></a>
<h3>Initializing a String</h3>
<p>One way to initialize a QString is simply to pass a <tt>const char *</tt> to its constructor. For example, the following code creates a QString of size 5 containing the data &quot;Hello&quot;:</p>
<pre class="cpp"> <span class="type">QString</span> str <span class="operator">=</span> <span class="string">&quot;Hello&quot;</span>;</pre>
<p>QString converts the <tt>const char *</tt> data into Unicode using the <a href="qstring.html#fromAscii">fromAscii</a>() function. By default, <a href="qstring.html#fromAscii">fromAscii</a>() treats character above 128 as Latin-1 characters, but this can be changed by calling <a href="qtextcodec.html#setCodecForCStrings">QTextCodec::setCodecForCStrings</a>().</p>
<p>In all of the QString functions that take <tt>const char *</tt> parameters, the <tt>const char *</tt> is interpreted as a classic C-style '\0'-terminated string. It is legal for the <tt>const char *</tt> parameter to be 0.</p>
<p>You can also provide string data as an array of <a href="qchar.html">QChar</a>s:</p>
<pre class="cpp"> <span class="keyword">static</span> <span class="keyword">const</span> <span class="type"><a href="qchar.html">QChar</a></span> data<span class="operator">[</span><span class="number">4</span><span class="operator">]</span> <span class="operator">=</span> { <span class="number">0x0055</span><span class="operator">,</span> <span class="number">0x006e</span><span class="operator">,</span> <span class="number">0x10e3</span><span class="operator">,</span> <span class="number">0x03a3</span> };
 <span class="type">QString</span> str(data<span class="operator">,</span> <span class="number">4</span>);</pre>
<p>QString makes a deep copy of the <a href="qchar.html">QChar</a> data, so you can modify it later without experiencing side effects. (If for performance reasons you don't want to take a deep copy of the character data, use <a href="qstring.html#fromRawData">QString::fromRawData</a>() instead.)</p>
<p>Another approach is to set the size of the string using <a href="qstring.html#resize">resize</a>() and to initialize the data character per character. QString uses 0-based indexes, just like C++ arrays. To access the character at a particular index position, you can use <a href="qstring.html#operator-5b-5d">operator[]</a>(). On non-const strings, <a href="qstring.html#operator-5b-5d">operator[]</a>() returns a reference to a character that can be used on the left side of an assignment. For example:</p>
<pre class="cpp"> <span class="type">QString</span> str;
 str<span class="operator">.</span>resize(<span class="number">4</span>);

 str<span class="operator">[</span><span class="number">0</span><span class="operator">]</span> <span class="operator">=</span> <span class="type"><a href="qchar.html">QChar</a></span>(<span class="char">'U'</span>);
 str<span class="operator">[</span><span class="number">1</span><span class="operator">]</span> <span class="operator">=</span> <span class="type"><a href="qchar.html">QChar</a></span>(<span class="char">'n'</span>);
 str<span class="operator">[</span><span class="number">2</span><span class="operator">]</span> <span class="operator">=</span> <span class="type"><a href="qchar.html">QChar</a></span>(<span class="number">0x10e3</span>);
 str<span class="operator">[</span><span class="number">3</span><span class="operator">]</span> <span class="operator">=</span> <span class="type"><a href="qchar.html">QChar</a></span>(<span class="number">0x03a3</span>);</pre>
<p>For read-only access, an alternative syntax is to use the <a href="qstring.html#at">at</a>() function:</p>
<pre class="cpp"> <span class="type">QString</span> str;

 <span class="keyword">for</span> (<span class="type">int</span> i <span class="operator">=</span> <span class="number">0</span>; i <span class="operator">&lt;</span> str<span class="operator">.</span>size(); <span class="operator">+</span><span class="operator">+</span>i) {
     <span class="keyword">if</span> (str<span class="operator">.</span>at(i) <span class="operator">&gt;</span><span class="operator">=</span> <span class="type"><a href="qchar.html">QChar</a></span>(<span class="char">'a'</span>) <span class="operator">&amp;</span><span class="operator">&amp;</span> str<span class="operator">.</span>at(i) <span class="operator">&lt;</span><span class="operator">=</span> <span class="type"><a href="qchar.html">QChar</a></span>(<span class="char">'f'</span>))
         <a href="qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;Found character in range [a-f]&quot;</span>;
 }</pre>
<p>The <a href="qstring.html#at">at</a>() function can be faster than <a href="qstring.html#operator-5b-5d">operator[]</a>(), because it never causes a <a href="implicit-sharing.html#deep-copy">deep copy</a> to occur. Alternatively, use the <a href="qstring.html#left">left</a>(), <a href="qstring.html#right">right</a>(), or <a href="qstring.html#mid">mid</a>() functions to extract several characters at a time.</p>
<p>A QString can embed '\0' characters (<a href="qchar.html#SpecialCharacter-enum">QChar::Null</a>). The <a href="qstring.html#size">size</a>() function always returns the size of the whole string, including embedded '\0' characters.</p>
<p>After a call to the <a href="qstring.html#resize">resize</a>() function, newly allocated characters have undefined values. To set all the characters in the string to a particular value, use the <a href="qstring.html#fill">fill</a>() function.</p>
<p>QString provides dozens of overloads designed to simplify string usage. For example, if you want to compare a QString with a string literal, you can write code like this and it will work as expected:</p>
<pre class="cpp"> <span class="type">QString</span> str;

 <span class="keyword">if</span> (str <span class="operator">=</span><span class="operator">=</span> <span class="string">&quot;auto&quot;</span> <span class="operator">|</span><span class="operator">|</span> str <span class="operator">=</span><span class="operator">=</span> <span class="string">&quot;extern&quot;</span>
         <span class="operator">|</span><span class="operator">|</span> str <span class="operator">=</span><span class="operator">=</span> <span class="string">&quot;static&quot;</span> <span class="operator">|</span><span class="operator">|</span> str <span class="operator">=</span><span class="operator">=</span> <span class="string">&quot;register&quot;</span>) {
     <span class="comment">// ...</span>
 }</pre>
<p>You can also pass string literals to functions that take QStrings as arguments, invoking the QString(const char *) constructor. Similarly, you can pass a QString to a function that takes a <tt>const char *</tt> argument using the <a href="qtglobal.html#qPrintable">qPrintable</a>() macro which returns the given QString as a <tt>const char *</tt>. This is equivalent to calling &lt;QString&gt;.<a href="qstring.html#toLocal8Bit">toLocal8Bit</a>().<a href="qstring.html#constData">constData</a>().</p>
<a name="manipulating-string-data"></a>
<h3>Manipulating String Data</h3>
<p>QString provides the following basic functions for modifying the character data: <a href="qstring.html#append">append</a>(), <a href="qstring.html#prepend">prepend</a>(), <a href="qstring.html#insert">insert</a>(), <a href="qstring.html#replace">replace</a>(), and <a href="qstring.html#remove">remove</a>(). For example:</p>
<pre class="cpp"> <span class="type">QString</span> str <span class="operator">=</span> <span class="string">&quot;and&quot;</span>;
 str<span class="operator">.</span>prepend(<span class="string">&quot;rock &quot;</span>);     <span class="comment">// str == &quot;rock and&quot;</span>
 str<span class="operator">.</span>append(<span class="string">&quot; roll&quot;</span>);        <span class="comment">// str == &quot;rock and roll&quot;</span>
 str<span class="operator">.</span>replace(<span class="number">5</span><span class="operator">,</span> <span class="number">3</span><span class="operator">,</span> <span class="string">&quot;&amp;&quot;</span>);   <span class="comment">// str == &quot;rock &amp; roll&quot;</span></pre>
<p>If you are building a QString gradually and know in advance approximately how many characters the QString will contain, you can call <a href="qstring.html#reserve">reserve</a>(), asking QString to preallocate a certain amount of memory. You can also call <a href="qstring.html#capacity">capacity</a>() to find out how much memory QString actually allocated.</p>
<p>The <a href="qstring.html#replace">replace</a>() and <a href="qstring.html#remove">remove</a>() functions' first two arguments are the position from which to start erasing and the number of characters that should be erased. If you want to replace all occurrences of a particular substring with another, use one of the two-parameter <a href="qstring.html#replace">replace</a>() overloads.</p>
<p>A frequent requirement is to remove whitespace characters from a string ('\n', '\t', ' ', etc.)&#x2e; If you want to remove whitespace from both ends of a QString, use the <a href="qstring.html#trimmed">trimmed</a>() function. If you want to remove whitespace from both ends and replace multiple consecutive whitespaces with a single space character within the string, use <a href="qstring.html#simplified">simplified</a>().</p>
<p>If you want to find all occurrences of a particular character or substring in a QString, use the <a href="qstring.html#indexOf">indexOf</a>() or <a href="qstring.html#lastIndexOf">lastIndexOf</a>() functions. The former searches forward starting from a given index position, the latter searches backward. Both return the index position of the character or substring if they find it; otherwise, they return -1. For example, here's a typical loop that finds all occurrences of a particular substring:</p>
<pre class="cpp"> <span class="type">QString</span> str <span class="operator">=</span> <span class="string">&quot;We must be &lt;b&gt;bold&lt;/b&gt;, very &lt;b&gt;bold&lt;/b&gt;&quot;</span>;
 <span class="type">int</span> j <span class="operator">=</span> <span class="number">0</span>;

 <span class="keyword">while</span> ((j <span class="operator">=</span> str<span class="operator">.</span>indexOf(<span class="string">&quot;&lt;b&gt;&quot;</span><span class="operator">,</span> j)) <span class="operator">!</span><span class="operator">=</span> <span class="operator">-</span><span class="number">1</span>) {
     <a href="qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;Found &lt;b&gt; tag at index position&quot;</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> j;
     <span class="operator">+</span><span class="operator">+</span>j;
 }</pre>
<p>QString provides many functions for converting numbers into strings and strings into numbers. See the <a href="qstring.html#arg">arg</a>() functions, the <a href="qstring.html#setNum">setNum</a>() functions, the <a href="qstring.html#number">number</a>() static functions, and the <a href="qstring.html#toInt">toInt</a>(), <a href="qstring.html#toDouble">toDouble</a>(), and similar functions.</p>
<p>To get an upper- or lowercase version of a string use <a href="qstring.html#toUpper">toUpper</a>() or <a href="qstring.html#toLower">toLower</a>().</p>
<p>Lists of strings are handled by the <a href="qstringlist.html">QStringList</a> class. You can split a string into a list of strings using the <a href="qstring.html#split">split</a>() function, and join a list of strings into a single string with an optional separator using <a href="qstringlist.html#join">QStringList::join</a>(). You can obtain a list of strings from a string list that contain a particular substring or that match a particular <a href="qregexp.html">QRegExp</a> using the <a href="qstringlist.html#filter">QStringList::filter</a>() function.</p>
<a name="querying-string-data"></a>
<h3>Querying String Data</h3>
<p>If you want to see if a QString starts or ends with a particular substring use <a href="qstring.html#startsWith">startsWith</a>() or <a href="qstring.html#endsWith">endsWith</a>(). If you simply want to check whether a QString contains a particular character or substring, use the <a href="qstring.html#contains">contains</a>() function. If you want to find out how many times a particular character or substring occurs in the string, use <a href="qstring.html#count">count</a>().</p>
<p>QStrings can be compared using overloaded operators such as <a href="qstring.html#operator-lt">operator&lt;</a>(), <a href="qstring.html#operator-lt-eq">operator&lt;=</a>(), <a href="qstring.html#operator-eq-eq">operator==</a>(), <a href="qstring.html#operator-gt-eq">operator&gt;=</a>(), and so on. Note that the comparison is based exclusively on the numeric Unicode values of the characters. It is very fast, but is not what a human would expect; the <a href="qstring.html#localeAwareCompare">QString::localeAwareCompare</a>() function is a better choice for sorting user-interface strings.</p>
<p>To obtain a pointer to the actual character data, call <a href="qstring.html#data">data</a>() or <a href="qstring.html#constData">constData</a>(). These functions return a pointer to the beginning of the <a href="qchar.html">QChar</a> data. The pointer is guaranteed to remain valid until a non-const function is called on the QString.</p>
<a name="converting-between-8-bit-strings-and-unicode-strings"></a>
<h3>Converting Between 8-Bit Strings and Unicode Strings</h3>
<p>QString provides the following four functions that return a <tt>const char *</tt> version of the string as <a href="qbytearray.html">QByteArray</a>: <a href="qstring.html#toAscii">toAscii</a>(), <a href="qstring.html#toLatin1">toLatin1</a>(), <a href="qstring.html#toUtf8">toUtf8</a>(), and <a href="qstring.html#toLocal8Bit">toLocal8Bit</a>().</p>
<ul>
<li><a href="qstring.html#toAscii">toAscii</a>() returns an 8-bit string encoded using the codec specified by QTextCodec::codecForCStrings (by default, that is Latin 1).</li>
<li><a href="qstring.html#toLatin1">toLatin1</a>() returns a Latin-1 (ISO 8859-1) encoded 8-bit string.</li>
<li><a href="qstring.html#toUtf8">toUtf8</a>() returns a UTF-8 encoded 8-bit string. UTF-8 is a superset of US-ASCII (ANSI X3.4-1986) that supports the entire Unicode character set through multibyte sequences.</li>
<li><a href="qstring.html#toLocal8Bit">toLocal8Bit</a>() returns an 8-bit string using the system's local encoding.</li>
</ul>
<p>To convert from one of these encodings, QString provides <a href="qstring.html#fromAscii">fromAscii</a>(), <a href="qstring.html#fromLatin1">fromLatin1</a>(), <a href="qstring.html#fromUtf8">fromUtf8</a>(), and <a href="qstring.html#fromLocal8Bit">fromLocal8Bit</a>(). Other encodings are supported through the <a href="qtextcodec.html">QTextCodec</a> class.</p>
<p>As mentioned above, QString provides a lot of functions and operators that make it easy to interoperate with <tt>const char *</tt> strings. But this functionality is a double-edged sword: It makes QString more convenient to use if all strings are US-ASCII or Latin-1, but there is always the risk that an implicit conversion from or to <tt>const char *</tt> is done using the wrong 8-bit encoding. To minimize these risks, you can turn off these implicit conversions by defining the following two preprocessor symbols:</p>
<ul>
<li><tt>QT_NO_CAST_FROM_ASCII</tt> disables automatic conversions from C string literals and pointers to Unicode.</li>
<li><tt>QT_NO_CAST_TO_ASCII</tt> disables automatic conversion from QString to C strings.</li>
</ul>
<p>One way to define these preprocessor symbols globally for your application is to add the following entry to your <a href="qmake-project-files.html">qmake project file</a>:</p>
<pre class="cpp"> DEFINES <span class="operator">+</span><span class="operator">=</span> QT_NO_CAST_FROM_ASCII \
            QT_NO_CAST_TO_ASCII</pre>
<p>You then need to explicitly call <a href="qstring.html#fromAscii">fromAscii</a>(), <a href="qstring.html#fromLatin1">fromLatin1</a>(), <a href="qstring.html#fromUtf8">fromUtf8</a>(), or <a href="qstring.html#fromLocal8Bit">fromLocal8Bit</a>() to construct a QString from an 8-bit string, or use the lightweight <a href="qlatin1string.html">QLatin1String</a> class, for example:</p>
<pre class="cpp"> <span class="type">QString</span> url <span class="operator">=</span> QLatin1String(<span class="string">&quot;http://www.unicode.org/&quot;</span>);</pre>
<p>Similarly, you must call <a href="qstring.html#toAscii">toAscii</a>(), <a href="qstring.html#toLatin1">toLatin1</a>(), <a href="qstring.html#toUtf8">toUtf8</a>(), or <a href="qstring.html#toLocal8Bit">toLocal8Bit</a>() explicitly to convert the QString to an 8-bit string. (Other encodings are supported through the <a href="qtextcodec.html">QTextCodec</a> class.)</p>
<table class="generic" width="100 %">
 <thead><tr class="qt-style"><th >Note for C Programmers</th></tr></thead>
<tr valign="top" class="odd"><td >Due to C++'s type system and the fact that QString is <a href="implicit-sharing.html#implicitly-shared">implicitly shared</a>, QStrings may be treated like <tt>int</tt>s or other basic types. For example:<pre class="cpp"> <span class="type">QString</span> Widget<span class="operator">::</span>boolToString(<span class="type">bool</span> b)
 {
     <span class="type">QString</span> result;
     <span class="keyword">if</span> (b)
         result <span class="operator">=</span> <span class="string">&quot;True&quot;</span>;
     <span class="keyword">else</span>
         result <span class="operator">=</span> <span class="string">&quot;False&quot;</span>;
     <span class="keyword">return</span> result;
 }</pre>
<p>The <tt>result</tt> variable, is a normal variable allocated on the stack. When <tt>return</tt> is called, and because we're returning by value, the copy constructor is called and a copy of the string is returned. No actual copying takes place thanks to the implicit sharing.</p>
</td></tr>
</table>
<a name="distinction-between-null-and-empty-strings"></a>
<h3>Distinction Between Null and Empty Strings</h3>
<p>For historical reasons, QString distinguishes between a null string and an empty string. A <i>null</i> string is a string that is initialized using QString's default constructor or by passing (const char *)0 to the constructor. An <i>empty</i> string is any string with size 0. A null string is always empty, but an empty string isn't necessarily null:</p>
<pre class="cpp"> <span class="type">QString</span>()<span class="operator">.</span>isNull();               <span class="comment">// returns true</span>
 <span class="type">QString</span>()<span class="operator">.</span>isEmpty();              <span class="comment">// returns true</span>

 <span class="type">QString</span>(<span class="string">&quot;&quot;</span>)<span class="operator">.</span>isNull();             <span class="comment">// returns false</span>
 <span class="type">QString</span>(<span class="string">&quot;&quot;</span>)<span class="operator">.</span>isEmpty();            <span class="comment">// returns true</span>

 <span class="type">QString</span>(<span class="string">&quot;abc&quot;</span>)<span class="operator">.</span>isNull();          <span class="comment">// returns false</span>
 <span class="type">QString</span>(<span class="string">&quot;abc&quot;</span>)<span class="operator">.</span>isEmpty();         <span class="comment">// returns false</span></pre>
<p>All functions except <a href="qstring.html#isNull">isNull</a>() treat null strings the same as empty strings. For example, <a href="qstring.html#toAscii">toAscii</a>().<a href="qstring.html#constData">constData</a>() returns a pointer to a '\0' character for a null string (<i>not</i> a null pointer), and <a href="qstring.html#QString">QString</a>() compares equal to QString(&quot;&quot;). We recommend that you always use the <a href="qstring.html#isEmpty">isEmpty</a>() function and avoid <a href="qstring.html#isNull">isNull</a>().</p>
<a name="argument-formats"></a>
<h3>Argument Formats</h3>
<p>In member functions where an argument <i>format</i> can be specified (e.g&#x2e;, <a href="qstring.html#arg">arg</a>(), <a href="qstring.html#number">number</a>()), the argument <i>format</i> can be one of the following:</p>
<table class="generic">
<thead><tr class="qt-style"><th >Format</th><th >Meaning</th></tr></thead>
<tr valign="top" class="odd"><td ><tt>e</tt></td><td >format as [-]9.9e[+|-]999</td></tr>
<tr valign="top" class="even"><td ><tt>E</tt></td><td >format as [-]9.9E[+|-]999</td></tr>
<tr valign="top" class="odd"><td ><tt>f</tt></td><td >format as [-]9.9</td></tr>
<tr valign="top" class="even"><td ><tt>g</tt></td><td >use <tt>e</tt> or <tt>f</tt> format, whichever is the most concise</td></tr>
<tr valign="top" class="odd"><td ><tt>G</tt></td><td >use <tt>E</tt> or <tt>f</tt> format, whichever is the most concise</td></tr>
</table>
<p>A <i>precision</i> is also specified with the argument <i>format</i>. For the 'e', 'E', and 'f' formats, the <i>precision</i> represents the number of digits <i>after</i> the decimal point. For the 'g' and 'G' formats, the <i>precision</i> represents the maximum number of significant digits (trailing zeroes are omitted).</p>
<a name="more-efficient-string-construction"></a>
<h3>More Efficient String Construction</h3>
<p>Using the QString <tt>'+'</tt> operator, it is easy to construct a complex string from multiple substrings. You will often write code like this:</p>
<pre class="cpp">     <span class="type">QString</span> foo;
     <span class="type">QString</span> type <span class="operator">=</span> <span class="string">&quot;long&quot;</span>;

     foo<span class="operator">-</span><span class="operator">&gt;</span>setText(QLatin1String(<span class="string">&quot;vector&lt;&quot;</span>) <span class="operator">+</span> type <span class="operator">+</span> QLatin1String(<span class="string">&quot;&gt;::iterator&quot;</span>));

     <span class="keyword">if</span> (foo<span class="operator">.</span>startsWith(<span class="string">&quot;(&quot;</span> <span class="operator">+</span> type <span class="operator">+</span> <span class="string">&quot;) 0x&quot;</span>))
         <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span></pre>
<p>There is nothing wrong with either of these string constructions, but there are a few hidden inefficiencies. Beginning with Qt 4.6, you can eliminate them.</p>
<p>First, multiple uses of the <tt>'+'</tt> operator usually means multiple memory allocations. When concatenating <i>n</i> substrings, where <i>n &gt; 2</i>, there can be as many as <i>n - 1</i> calls to the memory allocator.</p>
<p>Second, <a href="qlatin1string.html">QLatin1String</a> does not store its length internally but calls <a href="qbytearray.html#qstrlen">qstrlen</a>() when it needs to know its length.</p>
<p>In 4.6, an internal template class <tt>QStringBuilder</tt> has been added along with a few helper functions. This class is marked internal and does not appear in the documentation, because you aren't meant to instantiate it in your code. Its use will be automatic, as described below. The class is found in <tt>src/corelib/tools/qstringbuilder.cpp</tt> if you want to have a look at it.</p>
<p><tt>QStringBuilder</tt> uses expression templates and reimplements the <tt>'%'</tt> operator so that when you use <tt>'%'</tt> for string concatenation instead of <tt>'+'</tt>, multiple substring concatenations will be postponed until the final result is about to be assigned to a QString. At this point, the amount of memory required for the final result is known. The memory allocator is then called <i>once</i> to get the required space, and the substrings are copied into it one by one.</p>
<p><tt>QLatin1Literal</tt> is a second internal class that can replace <a href="qlatin1string.html">QLatin1String</a>, which can't be changed for compatibility reasons. <tt>QLatin1Literal</tt> stores its length, thereby saving time when <tt>QStringBuilder</tt> computes the amount of memory required for the final string.</p>
<p>Additional efficiency is gained by inlining and reduced reference counting (the QString created from a <tt>QStringBuilder</tt> typically has a ref count of 1, whereas <a href="qstring.html#append">QString::append</a>() needs an extra test).</p>
<p>There are three ways you can access this improved method of string construction. The straightforward way is to include <tt>QStringBuilder</tt> wherever you want to use it, and use the <tt>'%'</tt> operator instead of <tt>'+'</tt> when concatenating strings:</p>
<pre class="cpp">     <span class="preprocessor">#include &lt;QStringBuilder&gt;</span>

     <span class="type">QString</span> hello(<span class="string">&quot;hello&quot;</span>);
     <span class="type"><a href="qstringref.html">QStringRef</a></span> el(<span class="operator">&amp;</span>hello<span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="number">3</span>);
     QLatin1String world(<span class="string">&quot;world&quot;</span>);
     <span class="type">QString</span> message <span class="operator">=</span>  hello <span class="operator">%</span> el <span class="operator">%</span> world <span class="operator">%</span> <span class="type"><a href="qchar.html">QChar</a></span>(<span class="char">'!'</span>);</pre>
<p>A more global approach which is the most convenient but not entirely source compatible, is to this define in your .pro file:</p>
<pre class="cpp">     DEFINES <span class="operator">*</span><span class="operator">=</span> QT_USE_QSTRINGBUILDER</pre>
<p>and the <tt>'+'</tt> will automatically be performed as the <tt>QStringBuilder</tt> <tt>'%'</tt> everywhere.</p>
</div>
<p><b>See also </b><a href="qstring.html#fromRawData">fromRawData</a>(), <a href="qchar.html">QChar</a>, <a href="qlatin1string.html">QLatin1String</a>, <a href="qbytearray.html">QByteArray</a>, and <a href="qstringref.html">QStringRef</a>.</p>
<!-- @@@QString -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$ConstIterator -->
<h3 class="fn"><a name="ConstIterator-typedef"></a>typedef QString::<span class="name">ConstIterator</span></h3>
<p>Qt-style synonym for <a href="qstring.html#const_iterator-typedef">QString::const_iterator</a>.</p>
<!-- @@@ConstIterator -->
<!-- $$$Iterator -->
<h3 class="fn"><a name="Iterator-typedef"></a>typedef QString::<span class="name">Iterator</span></h3>
<p>Qt-style synonym for <a href="qstring.html#iterator-typedefx">QString::iterator</a>.</p>
<!-- @@@Iterator -->
<!-- $$$NormalizationForm$$$NormalizationForm_D$$$NormalizationForm_C$$$NormalizationForm_KD$$$NormalizationForm_KC -->
<h3 class="fn"><a name="NormalizationForm-enum"></a>enum QString::<span class="name">NormalizationForm</span></h3>
<p>This enum describes the various normalized forms of Unicode text.</p>
<table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><tt>QString::NormalizationForm_D</tt></td><td class="topAlign"><tt>0</tt></td><td class="topAlign">Canonical Decomposition</td></tr>
<tr><td class="topAlign"><tt>QString::NormalizationForm_C</tt></td><td class="topAlign"><tt>1</tt></td><td class="topAlign">Canonical Decomposition followed by Canonical Composition</td></tr>
<tr><td class="topAlign"><tt>QString::NormalizationForm_KD</tt></td><td class="topAlign"><tt>2</tt></td><td class="topAlign">Compatibility Decomposition</td></tr>
<tr><td class="topAlign"><tt>QString::NormalizationForm_KC</tt></td><td class="topAlign"><tt>3</tt></td><td class="topAlign">Compatibility Decomposition followed by Canonical Composition</td></tr>
</table>
<p><b>See also </b><a href="qstring.html#normalized">normalized</a>() and <a href="http://www.unicode.org/reports/tr15/">Unicode Standard Annex #15</a>.</p>
<!-- @@@NormalizationForm -->
<!-- $$$SectionFlag$$$SectionDefault$$$SectionSkipEmpty$$$SectionIncludeLeadingSep$$$SectionIncludeTrailingSep$$$SectionCaseInsensitiveSeps -->
<h3 class="flags"><a name="SectionFlag-enum"></a>enum QString::<span class="name">SectionFlag</span><br/>flags QString::<span class="name">SectionFlags</span></h3>
<p>This enum specifies flags that can be used to affect various aspects of the <a href="qstring.html#section">section</a>() function's behavior with respect to separators and empty fields.</p>
<table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><tt>QString::SectionDefault</tt></td><td class="topAlign"><tt>0x00</tt></td><td class="topAlign">Empty fields are counted, leading and trailing separators are not included, and the separator is compared case sensitively.</td></tr>
<tr><td class="topAlign"><tt>QString::SectionSkipEmpty</tt></td><td class="topAlign"><tt>0x01</tt></td><td class="topAlign">Treat empty fields as if they don't exist, i.e&#x2e; they are not considered as far as <i>start</i> and <i>end</i> are concerned.</td></tr>
<tr><td class="topAlign"><tt>QString::SectionIncludeLeadingSep</tt></td><td class="topAlign"><tt>0x02</tt></td><td class="topAlign">Include the leading separator (if any) in the result string.</td></tr>
<tr><td class="topAlign"><tt>QString::SectionIncludeTrailingSep</tt></td><td class="topAlign"><tt>0x04</tt></td><td class="topAlign">Include the trailing separator (if any) in the result string.</td></tr>
<tr><td class="topAlign"><tt>QString::SectionCaseInsensitiveSeps</tt></td><td class="topAlign"><tt>0x08</tt></td><td class="topAlign">Compare the separator case-insensitively.</td></tr>
</table>
<p>The SectionFlags type is a typedef for <a href="qflags.html">QFlags</a>&lt;SectionFlag&gt;. It stores an OR combination of SectionFlag values.</p>
<p><b>See also </b><a href="qstring.html#section">section</a>().</p>
<!-- @@@SectionFlag -->
<!-- $$$SplitBehavior$$$KeepEmptyParts$$$SkipEmptyParts -->
<h3 class="fn"><a name="SplitBehavior-enum"></a>enum QString::<span class="name">SplitBehavior</span></h3>
<p>This enum specifies how the <a href="qstring.html#split">split</a>() function should behave with respect to empty strings.</p>
<table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><tt>QString::KeepEmptyParts</tt></td><td class="topAlign"><tt>0</tt></td><td class="topAlign">If a field is empty, keep it in the result.</td></tr>
<tr><td class="topAlign"><tt>QString::SkipEmptyParts</tt></td><td class="topAlign"><tt>1</tt></td><td class="topAlign">If a field is empty, don't include it in the result.</td></tr>
</table>
<p><b>See also </b><a href="qstring.html#split">split</a>().</p>
<!-- @@@SplitBehavior -->
<!-- $$$const_iterator -->
<h3 class="fn"><a name="const_iterator-typedef"></a>typedef QString::<span class="name">const_iterator</span></h3>
<p>The QString::const_iterator typedef provides an STL-style const iterator for <a href="qstring.html">QString</a>.</p>
<p><b>See also </b><a href="qstring.html#iterator-typedefx">QString::iterator</a>.</p>
<!-- @@@const_iterator -->
<!-- $$$const_reference -->
<h3 class="fn"><a name="const_reference-typedef"></a>typedef QString::<span class="name">const_reference</span></h3>
<p>The QString::const_reference typedef provides an STL-style const reference for <a href="qstring.html">QString</a>.</p>
<p>This typedef was introduced in Qt 4.8.</p>
<!-- @@@const_reference -->
<!-- $$$iterator -->
<h3 class="fn"><a name="iterator-typedefx"></a>typedef QString::<span class="name">iterator</span></h3>
<p>The QString::iterator typedef provides an STL-style non-const iterator for <a href="qstring.html">QString</a>.</p>
<p><b>See also </b><a href="qstring.html#const_iterator-typedef">QString::const_iterator</a>.</p>
<!-- @@@iterator -->
<!-- $$$reference -->
<h3 class="fn"><a name="reference-typedef"></a>typedef QString::<span class="name">reference</span></h3>
<p>The <a href="qstring.html#const_reference-typedef">QString::const_reference</a> typedef provides an STL-style reference for <a href="qstring.html">QString</a>.</p>
<p>This typedef was introduced in Qt 4.8.</p>
<!-- @@@reference -->
<!-- $$$value_type -->
<h3 class="fn"><a name="value_type-typedef"></a>typedef QString::<span class="name">value_type</span></h3>
<p>The <a href="qstring.html#const_reference-typedef">QString::const_reference</a> typedef provides an STL-style value type for <a href="qstring.html">QString</a>.</p>
<p>This typedef was introduced in Qt 4.8.</p>
<!-- @@@value_type -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QString[overload1]$$$QString -->
<h3 class="fn"><a name="QString"></a>QString::<span class="name">QString</span> ()</h3>
<p>Constructs a null string. Null strings are also empty.</p>
<p><b>See also </b><a href="qstring.html#isEmpty">isEmpty</a>().</p>
<!-- @@@QString -->
<!-- $$$QString$$$QStringconstQChar*int -->
<h3 class="fn"><a name="QString-2"></a>QString::<span class="name">QString</span> ( const <span class="type"><a href="qchar.html">QChar</a></span> * <i>unicode</i>, <span class="type">int</span> <i>size</i> )</h3>
<p>Constructs a string initialized with the first <i>size</i> characters of the <a href="qchar.html">QChar</a> array <i>unicode</i>.</p>
<p><a href="qstring.html">QString</a> makes a deep copy of the string data. The unicode data is copied as is and the Byte Order Mark is preserved if present.</p>
<!-- @@@QString -->
<!-- $$$QString$$$QStringconstQChar* -->
<h3 class="fn"><a name="QString-3"></a>QString::<span class="name">QString</span> ( const <span class="type"><a href="qchar.html">QChar</a></span> * <i>unicode</i> )</h3>
<p>Constructs a string initialized with the characters of the <a href="qchar.html">QChar</a> array <i>unicode</i>, which must be terminated with a 0.</p>
<p><a href="qstring.html">QString</a> makes a deep copy of the string data. The unicode data is copied as is and the Byte Order Mark is preserved if present.</p>
<p>This function was introduced in Qt 4.7.</p>
<!-- @@@QString -->
<!-- $$$QString$$$QStringQChar -->
<h3 class="fn"><a name="QString-4"></a>QString::<span class="name">QString</span> ( <span class="type"><a href="qchar.html">QChar</a></span> <i>ch</i> )</h3>
<p>Constructs a string of size 1 containing the character <i>ch</i>.</p>
<!-- @@@QString -->
<!-- $$$QString$$$QStringintQChar -->
<h3 class="fn"><a name="QString-5"></a>QString::<span class="name">QString</span> ( <span class="type">int</span> <i>size</i>, <span class="type"><a href="qchar.html">QChar</a></span> <i>ch</i> )</h3>
<p>Constructs a string of the given <i>size</i> with every character set to <i>ch</i>.</p>
<p><b>See also </b><a href="qstring.html#fill">fill</a>().</p>
<!-- @@@QString -->
<!-- $$$QString$$$QStringconstQLatin1String& -->
<h3 class="fn"><a name="QString-6"></a>QString::<span class="name">QString</span> ( const <span class="type"><a href="qlatin1string.html">QLatin1String</a></span> &amp; <i>str</i> )</h3>
<p>Constructs a copy of the Latin-1 string <i>str</i>.</p>
<p><b>See also </b><a href="qstring.html#fromLatin1">fromLatin1</a>().</p>
<!-- @@@QString -->
<!-- $$$QString$$$QStringconstQString& -->
<h3 class="fn"><a name="QString-7"></a>QString::<span class="name">QString</span> ( const <span class="type">QString</span> &amp; <i>other</i> )</h3>
<p>Constructs a copy of <i>other</i>.</p>
<p>This operation takes <a href="containers.html#constant-time">constant time</a>, because <a href="qstring.html">QString</a> is <a href="implicit-sharing.html#implicitly-shared">implicitly shared</a>. This makes returning a <a href="qstring.html">QString</a> from a function very fast. If a shared instance is modified, it will be copied (copy-on-write), and that takes <a href="containers.html#linear-time">linear time</a>.</p>
<p><b>See also </b><a href="qstring.html#operator-eq">operator=</a>().</p>
<!-- @@@QString -->
<!-- $$$QString$$$QStringconstchar* -->
<h3 class="fn"><a name="QString-8"></a>QString::<span class="name">QString</span> ( const <span class="type">char</span> * <i>str</i> )</h3>
<p>Constructs a string initialized with the 8-bit string <i>str</i>. The given const char pointer is converted to Unicode using the <a href="qstring.html#fromAscii">fromAscii</a>() function.</p>
<p>You can disable this constructor by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
<p><b>See also </b><a href="qstring.html#fromAscii">fromAscii</a>(), <a href="qstring.html#fromLatin1">fromLatin1</a>(), <a href="qstring.html#fromLocal8Bit">fromLocal8Bit</a>(), and <a href="qstring.html#fromUtf8">fromUtf8</a>().</p>
<!-- @@@QString -->
<!-- $$$QString$$$QStringconstQByteArray& -->
<h3 class="fn"><a name="QString-9"></a>QString::<span class="name">QString</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; <i>ba</i> )</h3>
<p>Constructs a string initialized with the byte array <i>ba</i>. The given byte array is converted to Unicode using <a href="qstring.html#fromAscii">fromAscii</a>(). Stops copying at the first 0 character, otherwise copies the entire byte array.</p>
<p>You can disable this constructor by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
<p><b>See also </b><a href="qstring.html#fromAscii">fromAscii</a>(), <a href="qstring.html#fromLatin1">fromLatin1</a>(), <a href="qstring.html#fromLocal8Bit">fromLocal8Bit</a>(), and <a href="qstring.html#fromUtf8">fromUtf8</a>().</p>
<!-- @@@QString -->
<!-- $$$~QString[overload1]$$$~QString -->
<h3 class="fn"><a name="dtor.QString"></a>QString::<span class="name">~QString</span> ()</h3>
<p>Destroys the string.</p>
<!-- @@@~QString -->
<!-- $$$append[overload1]$$$appendconstQString& -->
<h3 class="fn"><a name="append"></a><span class="type">QString</span> &amp; QString::<span class="name">append</span> ( const <span class="type">QString</span> &amp; <i>str</i> )</h3>
<p>Appends the string <i>str</i> onto the end of this string.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> x <span class="operator">=</span> <span class="string">&quot;free&quot;</span>;
 <span class="type"><a href="qstring.html">QString</a></span> y <span class="operator">=</span> <span class="string">&quot;dom&quot;</span>;

 x<span class="operator">.</span>append(y);
 <span class="comment">// x == &quot;freedom&quot;</span></pre>
<p>This is the same as using the <a href="qstring.html#insert">insert</a>() function:</p>
<pre class="cpp"> x<span class="operator">.</span>insert(x<span class="operator">.</span>size()<span class="operator">,</span> y);</pre>
<p>The append() function is typically very fast (<a href="containers.html#constant-time">constant time</a>), because <a href="qstring.html">QString</a> preallocates extra space at the end of the string data so it can grow without reallocating the entire string each time.</p>
<p><b>See also </b><a href="qstring.html#operator-2b-eq">operator+=</a>(), <a href="qstring.html#prepend">prepend</a>(), and <a href="qstring.html#insert">insert</a>().</p>
<!-- @@@append -->
<!-- $$$append$$$appendconstQStringRef& -->
<h3 class="fn"><a name="append-2"></a><span class="type">QString</span> &amp; QString::<span class="name">append</span> ( const <span class="type"><a href="qstringref.html">QStringRef</a></span> &amp; <i>reference</i> )</h3>
<p>Appends the given string <i>reference</i> to this string and returns the result.</p>
<p>This function was introduced in Qt 4.4.</p>
<!-- @@@append -->
<!-- $$$append$$$appendconstQLatin1String& -->
<h3 class="fn"><a name="append-3"></a><span class="type">QString</span> &amp; QString::<span class="name">append</span> ( const <span class="type"><a href="qlatin1string.html">QLatin1String</a></span> &amp; <i>str</i> )</h3>
<p>This function overloads <a href="qstring.html#append">append</a>().</p>
<p>Appends the Latin-1 string <i>str</i> to this string.</p>
<!-- @@@append -->
<!-- $$$append$$$appendconstQByteArray& -->
<h3 class="fn"><a name="append-4"></a><span class="type">QString</span> &amp; QString::<span class="name">append</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; <i>ba</i> )</h3>
<p>This function overloads <a href="qstring.html#append">append</a>().</p>
<p>Appends the byte array <i>ba</i> to this string. The given byte array is converted to Unicode using the <a href="qstring.html#fromAscii">fromAscii</a>() function.</p>
<p>You can disable this function by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
<!-- @@@append -->
<!-- $$$append$$$appendconstchar* -->
<h3 class="fn"><a name="append-5"></a><span class="type">QString</span> &amp; QString::<span class="name">append</span> ( const <span class="type">char</span> * <i>str</i> )</h3>
<p>This function overloads <a href="qstring.html#append">append</a>().</p>
<p>Appends the string <i>str</i> to this string. The given const char pointer is converted to Unicode using the <a href="qstring.html#fromAscii">fromAscii</a>() function.</p>
<p>You can disable this function by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
<!-- @@@append -->
<!-- $$$append$$$appendQChar -->
<h3 class="fn"><a name="append-6"></a><span class="type">QString</span> &amp; QString::<span class="name">append</span> ( <span class="type"><a href="qchar.html">QChar</a></span> <i>ch</i> )</h3>
<p>This function overloads <a href="qstring.html#append">append</a>().</p>
<p>Appends the character <i>ch</i> to this string.</p>
<!-- @@@append -->
<!-- $$$arg[overload1]$$$argconstQString&intconstQChar& -->
<h3 class="fn"><a name="arg"></a><span class="type">QString</span> QString::<span class="name">arg</span> ( const <span class="type">QString</span> &amp; <i>a</i>, <span class="type">int</span> <i>fieldWidth</i> = 0, const <span class="type"><a href="qchar.html">QChar</a></span> &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</h3>
<p>Returns a copy of this string with the lowest numbered place marker replaced by string <i>a</i>, i.e&#x2e;, <tt>%1</tt>, <tt>%2</tt>, ..&#x2e;, <tt>%99</tt>.</p>
<p><i>fieldWidth</i> specifies the minimum amount of space that argument <i>a</i> shall occupy. If <i>a</i> requires less space than <i>fieldWidth</i>, it is padded to <i>fieldWidth</i> with character <i>fillChar</i>. A positive <i>fieldWidth</i> produces right-aligned text. A negative <i>fieldWidth</i> produces left-aligned text.</p>
<p>This example shows how we might create a <tt>status</tt> string for reporting progress while processing a list of files:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> i;           <span class="comment">// current file's number</span>
 <span class="type"><a href="qstring.html">QString</a></span> total;       <span class="comment">// number of files to process</span>
 <span class="type"><a href="qstring.html">QString</a></span> fileName;    <span class="comment">// current file's name</span>

 <span class="type"><a href="qstring.html">QString</a></span> status <span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span>(<span class="string">&quot;Processing file %1 of %2: %3&quot;</span>)
                 <span class="operator">.</span>arg(i)<span class="operator">.</span>arg(total)<span class="operator">.</span>arg(fileName);</pre>
<p>First, <tt>arg(i)</tt> replaces <tt>%1</tt>. Then <tt>arg(total)</tt> replaces <tt>%2</tt>. Finally, <tt>arg(fileName)</tt> replaces <tt>%3</tt>.</p>
<p>One advantage of using arg() over <a href="qstring.html#sprintf">sprintf</a>() is that the order of the numbered place markers can change, if the application's strings are translated into other languages, but each arg() will still replace the lowest numbered unreplaced place marker, no matter where it appears. Also, if place marker <tt>%i</tt> appears more than once in the string, the arg() replaces all of them.</p>
<p>If there is no unreplaced place marker remaining, a warning message is output and the result is undefined. Place marker numbers must be in the range 1 to 99.</p>
<!-- @@@arg -->
<!-- $$$arg$$$argconstQString&constQString& -->
<h3 class="fn"><a name="arg-2"></a><span class="type">QString</span> QString::<span class="name">arg</span> ( const <span class="type">QString</span> &amp; <i>a1</i>, const <span class="type">QString</span> &amp; <i>a2</i> ) const</h3>
<p>This function overloads <a href="qstring.html#arg">arg</a>().</p>
<p>This is the same as <tt>str.arg(a1).arg(a2)</tt>, except that the strings <i>a1</i> and <i>a2</i> are replaced in one pass. This can make a difference if <i>a1</i> contains e.g&#x2e; <tt>%1</tt>:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str;
 str <span class="operator">=</span> <span class="string">&quot;%1 %2&quot;</span>;

 str<span class="operator">.</span>arg(<span class="string">&quot;%1f&quot;</span><span class="operator">,</span> <span class="string">&quot;Hello&quot;</span>);        <span class="comment">// returns &quot;%1f Hello&quot;</span>
 str<span class="operator">.</span>arg(<span class="string">&quot;%1f&quot;</span>)<span class="operator">.</span>arg(<span class="string">&quot;Hello&quot;</span>);    <span class="comment">// returns &quot;Hellof %2&quot;</span></pre>
<!-- @@@arg -->
<!-- $$$arg$$$argconstQString&constQString&constQString& -->
<h3 class="fn"><a name="arg-3"></a><span class="type">QString</span> QString::<span class="name">arg</span> ( const <span class="type">QString</span> &amp; <i>a1</i>, const <span class="type">QString</span> &amp; <i>a2</i>, const <span class="type">QString</span> &amp; <i>a3</i> ) const</h3>
<p>This function overloads <a href="qstring.html#arg">arg</a>().</p>
<p>This is the same as calling <tt>str.arg(a1).arg(a2).arg(a3)</tt>, except that the strings <i>a1</i>, <i>a2</i> and <i>a3</i> are replaced in one pass.</p>
<!-- @@@arg -->
<!-- $$$arg$$$argconstQString&constQString&constQString&constQString& -->
<h3 class="fn"><a name="arg-4"></a><span class="type">QString</span> QString::<span class="name">arg</span> ( const <span class="type">QString</span> &amp; <i>a1</i>, const <span class="type">QString</span> &amp; <i>a2</i>, const <span class="type">QString</span> &amp; <i>a3</i>, const <span class="type">QString</span> &amp; <i>a4</i> ) const</h3>
<p>This function overloads <a href="qstring.html#arg">arg</a>().</p>
<p>This is the same as calling <tt>str.arg(a1).arg(a2).arg(a3).arg(a4)</tt>, except that the strings <i>a1</i>, <i>a2</i>, <i>a3</i> and <i>a4</i> are replaced in one pass.</p>
<!-- @@@arg -->
<!-- $$$arg$$$argconstQString&constQString&constQString&constQString&constQString& -->
<h3 class="fn"><a name="arg-5"></a><span class="type">QString</span> QString::<span class="name">arg</span> ( const <span class="type">QString</span> &amp; <i>a1</i>, const <span class="type">QString</span> &amp; <i>a2</i>, const <span class="type">QString</span> &amp; <i>a3</i>, const <span class="type">QString</span> &amp; <i>a4</i>, const <span class="type">QString</span> &amp; <i>a5</i> ) const</h3>
<p>This function overloads <a href="qstring.html#arg">arg</a>().</p>
<p>This is the same as calling <tt>str.arg(a1).arg(a2).arg(a3).arg(a4).arg(a5)</tt>, except that the strings <i>a1</i>, <i>a2</i>, <i>a3</i>, <i>a4</i>, and <i>a5</i> are replaced in one pass.</p>
<!-- @@@arg -->
<!-- $$$arg$$$argconstQString&constQString&constQString&constQString&constQString&constQString& -->
<h3 class="fn"><a name="arg-6"></a><span class="type">QString</span> QString::<span class="name">arg</span> ( const <span class="type">QString</span> &amp; <i>a1</i>, const <span class="type">QString</span> &amp; <i>a2</i>, const <span class="type">QString</span> &amp; <i>a3</i>, const <span class="type">QString</span> &amp; <i>a4</i>, const <span class="type">QString</span> &amp; <i>a5</i>, const <span class="type">QString</span> &amp; <i>a6</i> ) const</h3>
<p>This function overloads <a href="qstring.html#arg">arg</a>().</p>
<p>This is the same as calling <tt>str.arg(a1).arg(a2).arg(a3).arg(a4).arg(a5).arg(a6))</tt>, except that the strings <i>a1</i>, <i>a2</i>, <i>a3</i>, <i>a4</i>, <i>a5</i>, and <i>a6</i> are replaced in one pass.</p>
<!-- @@@arg -->
<!-- $$$arg$$$argconstQString&constQString&constQString&constQString&constQString&constQString&constQString& -->
<h3 class="fn"><a name="arg-7"></a><span class="type">QString</span> QString::<span class="name">arg</span> ( const <span class="type">QString</span> &amp; <i>a1</i>, const <span class="type">QString</span> &amp; <i>a2</i>, const <span class="type">QString</span> &amp; <i>a3</i>, const <span class="type">QString</span> &amp; <i>a4</i>, const <span class="type">QString</span> &amp; <i>a5</i>, const <span class="type">QString</span> &amp; <i>a6</i>, const <span class="type">QString</span> &amp; <i>a7</i> ) const</h3>
<p>This function overloads <a href="qstring.html#arg">arg</a>().</p>
<p>This is the same as calling <tt>str.arg(a1).arg(a2).arg(a3).arg(a4).arg(a5).arg(a6).arg(a7)</tt>, except that the strings <i>a1</i>, <i>a2</i>, <i>a3</i>, <i>a4</i>, <i>a5</i>, <i>a6</i>, and <i>a7</i> are replaced in one pass.</p>
<!-- @@@arg -->
<!-- $$$arg$$$argconstQString&constQString&constQString&constQString&constQString&constQString&constQString&constQString& -->
<h3 class="fn"><a name="arg-8"></a><span class="type">QString</span> QString::<span class="name">arg</span> ( const <span class="type">QString</span> &amp; <i>a1</i>, const <span class="type">QString</span> &amp; <i>a2</i>, const <span class="type">QString</span> &amp; <i>a3</i>, const <span class="type">QString</span> &amp; <i>a4</i>, const <span class="type">QString</span> &amp; <i>a5</i>, const <span class="type">QString</span> &amp; <i>a6</i>, const <span class="type">QString</span> &amp; <i>a7</i>, const <span class="type">QString</span> &amp; <i>a8</i> ) const</h3>
<p>This function overloads <a href="qstring.html#arg">arg</a>().</p>
<p>This is the same as calling <tt>str.arg(a1).arg(a2).arg(a3).arg(a4).arg(a5).arg(a6).arg(a7).arg(a8)</tt>, except that the strings <i>a1</i>, <i>a2</i>, <i>a3</i>, <i>a4</i>, <i>a5</i>, <i>a6</i>, <i>a7</i>, and <i>a8</i> are replaced in one pass.</p>
<!-- @@@arg -->
<!-- $$$arg$$$argconstQString&constQString&constQString&constQString&constQString&constQString&constQString&constQString&constQString& -->
<h3 class="fn"><a name="arg-9"></a><span class="type">QString</span> QString::<span class="name">arg</span> ( const <span class="type">QString</span> &amp; <i>a1</i>, const <span class="type">QString</span> &amp; <i>a2</i>, const <span class="type">QString</span> &amp; <i>a3</i>, const <span class="type">QString</span> &amp; <i>a4</i>, const <span class="type">QString</span> &amp; <i>a5</i>, const <span class="type">QString</span> &amp; <i>a6</i>, const <span class="type">QString</span> &amp; <i>a7</i>, const <span class="type">QString</span> &amp; <i>a8</i>, const <span class="type">QString</span> &amp; <i>a9</i> ) const</h3>
<p>This function overloads <a href="qstring.html#arg">arg</a>().</p>
<p>This is the same as calling <tt>str.arg(a1).arg(a2).arg(a3).arg(a4).arg(a5).arg(a6).arg(a7).arg(a8).arg(a9)</tt>, except that the strings <i>a1</i>, <i>a2</i>, <i>a3</i>, <i>a4</i>, <i>a5</i>, <i>a6</i>, <i>a7</i>, <i>a8</i>, and <i>a9</i> are replaced in one pass.</p>
<!-- @@@arg -->
<!-- $$$arg$$$argintintintconstQChar& -->
<h3 class="fn"><a name="arg-10"></a><span class="type">QString</span> QString::<span class="name">arg</span> ( <span class="type">int</span> <i>a</i>, <span class="type">int</span> <i>fieldWidth</i> = 0, <span class="type">int</span> <i>base</i> = 10, const <span class="type"><a href="qchar.html">QChar</a></span> &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</h3>
<p>This function overloads <a href="qstring.html#arg">arg</a>().</p>
<p>The <i>a</i> argument is expressed in base <i>base</i>, which is 10 by default and must be between 2 and 36. For bases other than 10, <i>a</i> is treated as an unsigned integer.</p>
<p><i>fieldWidth</i> specifies the minimum amount of space that <i>a</i> is padded to and filled with the character <i>fillChar</i>. A positive value produces right-aligned text; a negative value produces left-aligned text.</p>
<p>The '%' can be followed by an 'L', in which case the sequence is replaced with a localized representation of <i>a</i>. The conversion uses the default locale, set by <a href="qlocale.html#setDefault">QLocale::setDefault</a>(). If no default locale was specified, the &quot;C&quot; locale is used. The 'L' flag is ignored if <i>base</i> is not 10.</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str;
 str <span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span>(<span class="string">&quot;Decimal 63 is %1 in hexadecimal&quot;</span>)
         <span class="operator">.</span>arg(<span class="number">63</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">16</span>);
 <span class="comment">// str == &quot;Decimal 63 is 3f in hexadecimal&quot;</span>

 <span class="type"><a href="qlocale.html">QLocale</a></span><span class="operator">::</span>setDefault(<span class="type"><a href="qlocale.html">QLocale</a></span>(<span class="type"><a href="qlocale.html">QLocale</a></span><span class="operator">::</span>English<span class="operator">,</span> <span class="type"><a href="qlocale.html">QLocale</a></span><span class="operator">::</span>UnitedStates));
 str <span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span>(<span class="string">&quot;%1 %L2 %L3&quot;</span>)
         <span class="operator">.</span>arg(<span class="number">12345</span>)
         <span class="operator">.</span>arg(<span class="number">12345</span>)
         <span class="operator">.</span>arg(<span class="number">12345</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">16</span>);
 <span class="comment">// str == &quot;12345 12,345 3039&quot;</span></pre>
<p>If <i>fillChar</i> is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.</p>
<!-- @@@arg -->
<!-- $$$arg$$$arguintintintconstQChar& -->
<h3 class="fn"><a name="arg-11"></a><span class="type">QString</span> QString::<span class="name">arg</span> ( <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> <i>a</i>, <span class="type">int</span> <i>fieldWidth</i> = 0, <span class="type">int</span> <i>base</i> = 10, const <span class="type"><a href="qchar.html">QChar</a></span> &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</h3>
<p>This function overloads <a href="qstring.html#arg">arg</a>().</p>
<p>The <i>base</i> argument specifies the base to use when converting the integer <i>a</i> into a string. The base must be between 2 and 36.</p>
<p>If <i>fillChar</i> is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.</p>
<!-- @@@arg -->
<!-- $$$arg$$$arglongintintconstQChar& -->
<h3 class="fn"><a name="arg-12"></a><span class="type">QString</span> QString::<span class="name">arg</span> ( <span class="type">long</span> <i>a</i>, <span class="type">int</span> <i>fieldWidth</i> = 0, <span class="type">int</span> <i>base</i> = 10, const <span class="type"><a href="qchar.html">QChar</a></span> &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</h3>
<p>This function overloads <a href="qstring.html#arg">arg</a>().</p>
<p><i>fieldWidth</i> specifies the minimum amount of space that <i>a</i> is padded to and filled with the character <i>fillChar</i>. A positive value produces right-aligned text; a negative value produces left-aligned text.</p>
<p>The <i>a</i> argument is expressed in the given <i>base</i>, which is 10 by default and must be between 2 and 36.</p>
<p>The '%' can be followed by an 'L', in which case the sequence is replaced with a localized representation of <i>a</i>. The conversion uses the default locale. The default locale is determined from the system's locale settings at application startup. It can be changed using <a href="qlocale.html#setDefault">QLocale::setDefault</a>(). The 'L' flag is ignored if <i>base</i> is not 10.</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str;
 str <span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span>(<span class="string">&quot;Decimal 63 is %1 in hexadecimal&quot;</span>)
         <span class="operator">.</span>arg(<span class="number">63</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">16</span>);
 <span class="comment">// str == &quot;Decimal 63 is 3f in hexadecimal&quot;</span>

 <span class="type"><a href="qlocale.html">QLocale</a></span><span class="operator">::</span>setDefault(<span class="type"><a href="qlocale.html">QLocale</a></span>(<span class="type"><a href="qlocale.html">QLocale</a></span><span class="operator">::</span>English<span class="operator">,</span> <span class="type"><a href="qlocale.html">QLocale</a></span><span class="operator">::</span>UnitedStates));
 str <span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span>(<span class="string">&quot;%1 %L2 %L3&quot;</span>)
         <span class="operator">.</span>arg(<span class="number">12345</span>)
         <span class="operator">.</span>arg(<span class="number">12345</span>)
         <span class="operator">.</span>arg(<span class="number">12345</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">16</span>);
 <span class="comment">// str == &quot;12345 12,345 3039&quot;</span></pre>
<p>If <i>fillChar</i> is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.</p>
<!-- @@@arg -->
<!-- $$$arg$$$argulongintintconstQChar& -->
<h3 class="fn"><a name="arg-13"></a><span class="type">QString</span> QString::<span class="name">arg</span> ( <span class="type"><a href="qtglobal.html#ulong-typedef">ulong</a></span> <i>a</i>, <span class="type">int</span> <i>fieldWidth</i> = 0, <span class="type">int</span> <i>base</i> = 10, const <span class="type"><a href="qchar.html">QChar</a></span> &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</h3>
<p>This function overloads <a href="qstring.html#arg">arg</a>().</p>
<p><i>fieldWidth</i> specifies the minimum amount of space that <i>a</i> is padded to and filled with the character <i>fillChar</i>. A positive value produces right-aligned text; a negative value produces left-aligned text.</p>
<p>The <i>base</i> argument specifies the base to use when converting the integer <i>a</i> to a string. The base must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.</p>
<p>If <i>fillChar</i> is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.</p>
<!-- @@@arg -->
<!-- $$$arg$$$argqlonglongintintconstQChar& -->
<h3 class="fn"><a name="arg-14"></a><span class="type">QString</span> QString::<span class="name">arg</span> ( <span class="type"><a href="qtglobal.html#qlonglong-typedef">qlonglong</a></span> <i>a</i>, <span class="type">int</span> <i>fieldWidth</i> = 0, <span class="type">int</span> <i>base</i> = 10, const <span class="type"><a href="qchar.html">QChar</a></span> &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</h3>
<p>This function overloads <a href="qstring.html#arg">arg</a>().</p>
<p><i>fieldWidth</i> specifies the minimum amount of space that <i>a</i> is padded to and filled with the character <i>fillChar</i>. A positive value produces right-aligned text; a negative value produces left-aligned text.</p>
<p>The <i>base</i> argument specifies the base to use when converting the integer <i>a</i> into a string. The base must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.</p>
<p>If <i>fillChar</i> is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.</p>
<!-- @@@arg -->
<!-- $$$arg$$$argqulonglongintintconstQChar& -->
<h3 class="fn"><a name="arg-15"></a><span class="type">QString</span> QString::<span class="name">arg</span> ( <span class="type"><a href="qtglobal.html#qulonglong-typedef">qulonglong</a></span> <i>a</i>, <span class="type">int</span> <i>fieldWidth</i> = 0, <span class="type">int</span> <i>base</i> = 10, const <span class="type"><a href="qchar.html">QChar</a></span> &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</h3>
<p>This function overloads <a href="qstring.html#arg">arg</a>().</p>
<p><i>fieldWidth</i> specifies the minimum amount of space that <i>a</i> is padded to and filled with the character <i>fillChar</i>. A positive value produces right-aligned text; a negative value produces left-aligned text.</p>
<p>The <i>base</i> argument specifies the base to use when converting the integer <i>a</i> into a string. <i>base</i> must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.</p>
<p>If <i>fillChar</i> is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.</p>
<!-- @@@arg -->
<!-- $$$arg$$$argshortintintconstQChar& -->
<h3 class="fn"><a name="arg-16"></a><span class="type">QString</span> QString::<span class="name">arg</span> ( <span class="type">short</span> <i>a</i>, <span class="type">int</span> <i>fieldWidth</i> = 0, <span class="type">int</span> <i>base</i> = 10, const <span class="type"><a href="qchar.html">QChar</a></span> &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</h3>
<p>This function overloads <a href="qstring.html#arg">arg</a>().</p>
<p><i>fieldWidth</i> specifies the minimum amount of space that <i>a</i> is padded to and filled with the character <i>fillChar</i>. A positive value produces right-aligned text; a negative value produces left-aligned text.</p>
<p>The <i>base</i> argument specifies the base to use when converting the integer <i>a</i> into a string. The base must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.</p>
<p>If <i>fillChar</i> is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.</p>
<!-- @@@arg -->
<!-- $$$arg$$$argushortintintconstQChar& -->
<h3 class="fn"><a name="arg-17"></a><span class="type">QString</span> QString::<span class="name">arg</span> ( <span class="type"><a href="qtglobal.html#ushort-typedef">ushort</a></span> <i>a</i>, <span class="type">int</span> <i>fieldWidth</i> = 0, <span class="type">int</span> <i>base</i> = 10, const <span class="type"><a href="qchar.html">QChar</a></span> &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</h3>
<p>This function overloads <a href="qstring.html#arg">arg</a>().</p>
<p><i>fieldWidth</i> specifies the minimum amount of space that <i>a</i> is padded to and filled with the character <i>fillChar</i>. A positive value produces right-aligned text; a negative value produces left-aligned text.</p>
<p>The <i>base</i> argument specifies the base to use when converting the integer <i>a</i> into a string. The base must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.</p>
<p>If <i>fillChar</i> is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.</p>
<!-- @@@arg -->
<!-- $$$arg$$$argQCharintconstQChar& -->
<h3 class="fn"><a name="arg-18"></a><span class="type">QString</span> QString::<span class="name">arg</span> ( <span class="type"><a href="qchar.html">QChar</a></span> <i>a</i>, <span class="type">int</span> <i>fieldWidth</i> = 0, const <span class="type"><a href="qchar.html">QChar</a></span> &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</h3>
<p>This function overloads <a href="qstring.html#arg">arg</a>().</p>
<!-- @@@arg -->
<!-- $$$arg$$$argcharintconstQChar& -->
<h3 class="fn"><a name="arg-19"></a><span class="type">QString</span> QString::<span class="name">arg</span> ( <span class="type">char</span> <i>a</i>, <span class="type">int</span> <i>fieldWidth</i> = 0, const <span class="type"><a href="qchar.html">QChar</a></span> &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</h3>
<p>This function overloads <a href="qstring.html#arg">arg</a>().</p>
<p>The <i>a</i> argument is interpreted as a Latin-1 character.</p>
<!-- @@@arg -->
<!-- $$$arg$$$argdoubleintcharintconstQChar& -->
<h3 class="fn"><a name="arg-20"></a><span class="type">QString</span> QString::<span class="name">arg</span> ( <span class="type">double</span> <i>a</i>, <span class="type">int</span> <i>fieldWidth</i> = 0, <span class="type">char</span> <i>format</i> = 'g', <span class="type">int</span> <i>precision</i> = -1, const <span class="type"><a href="qchar.html">QChar</a></span> &amp; <i>fillChar</i> = QLatin1Char( ' ' ) ) const</h3>
<p>This function overloads <a href="qstring.html#arg">arg</a>().</p>
<p>Argument <i>a</i> is formatted according to the specified <i>format</i> and <i>precision</i>. See <a href="qstring.html#argument-formats">Argument Formats</a> for details.</p>
<p><i>fieldWidth</i> specifies the minimum amount of space that <i>a</i> is padded to and filled with the character <i>fillChar</i>. A positive value produces right-aligned text; a negative value produces left-aligned text.</p>
<pre class="cpp"> <span class="type">double</span> d <span class="operator">=</span> <span class="number">12.34</span>;
 <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span>(<span class="string">&quot;delta: %1&quot;</span>)<span class="operator">.</span><a href="qstring.html#arg">arg</a>(d<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="char">'E'</span><span class="operator">,</span> <span class="number">3</span>);
 <span class="comment">// str == &quot;delta: 1.234E+01&quot;</span></pre>
<p>The '%' can be followed by an 'L', in which case the sequence is replaced with a localized representation of <i>a</i>. The conversion uses the default locale, set by QLocale::setDefaultLocale(). If no default locale was specified, the &quot;C&quot; locale is used.</p>
<p>If <i>fillChar</i> is '0' (the number 0, ASCII 48), this function will use the locale's zero to pad. For negative numbers, the zero padding will probably appear before the minus sign.</p>
<p><b>See also </b><a href="qlocale.html#toString">QLocale::toString</a>().</p>
<!-- @@@arg -->
<!-- $$$at[overload1]$$$atint -->
<h3 class="fn"><a name="at"></a>const <span class="type"><a href="qchar.html">QChar</a></span> QString::<span class="name">at</span> ( <span class="type">int</span> <i>position</i> ) const</h3>
<p>Returns the character at the given index <i>position</i> in the string.</p>
<p>The <i>position</i> must be a valid index position in the string (i.e&#x2e;, 0 &lt;= <i>position</i> &lt; <a href="qstring.html#size">size</a>()).</p>
<p><b>See also </b><a href="qstring.html#operator-5b-5d">operator[]</a>().</p>
<!-- @@@at -->
<!-- $$$begin[overload1]$$$begin -->
<h3 class="fn"><a name="begin"></a><span class="type"><a href="qstring.html#iterator-typedefx">iterator</a></span> QString::<span class="name">begin</span> ()</h3>
<p>Returns an <a href="containers.html#stl-style-iterators">STL-style iterator</a> pointing to the first character in the string.</p>
<p><b>See also </b><a href="qstring.html#constBegin">constBegin</a>() and <a href="qstring.html#end">end</a>().</p>
<!-- @@@begin -->
<!-- $$$begin$$$begin -->
<h3 class="fn"><a name="begin-2"></a><span class="type"><a href="qstring.html#const_iterator-typedef">const_iterator</a></span> QString::<span class="name">begin</span> () const</h3>
<p>This function overloads <a href="qstring.html#begin">begin</a>().</p>
<!-- @@@begin -->
<!-- $$$capacity[overload1]$$$capacity -->
<h3 class="fn"><a name="capacity"></a><span class="type">int</span> QString::<span class="name">capacity</span> () const</h3>
<p>Returns the maximum number of characters that can be stored in the string without forcing a reallocation.</p>
<p>The sole purpose of this function is to provide a means of fine tuning <a href="qstring.html">QString</a>'s memory usage. In general, you will rarely ever need to call this function. If you want to know how many characters are in the string, call <a href="qstring.html#size">size</a>().</p>
<p><b>See also </b><a href="qstring.html#reserve">reserve</a>() and <a href="qstring.html#squeeze">squeeze</a>().</p>
<!-- @@@capacity -->
<!-- $$$chop[overload1]$$$chopint -->
<h3 class="fn"><a name="chop"></a><span class="type">void</span> QString::<span class="name">chop</span> ( <span class="type">int</span> <i>n</i> )</h3>
<p>Removes <i>n</i> characters from the end of the string.</p>
<p>If <i>n</i> is greater than <a href="qstring.html#size">size</a>(), the result is an empty string.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str(<span class="string">&quot;LOGOUT\r\n&quot;</span>);
 str<span class="operator">.</span>chop(<span class="number">2</span>);
 <span class="comment">// str == &quot;LOGOUT&quot;</span></pre>
<p>If you want to remove characters from the <i>beginning</i> of the string, use <a href="qstring.html#remove">remove</a>() instead.</p>
<p><b>See also </b><a href="qstring.html#truncate">truncate</a>(), <a href="qstring.html#resize">resize</a>(), and <a href="qstring.html#remove">remove</a>().</p>
<!-- @@@chop -->
<!-- $$$clear[overload1]$$$clear -->
<h3 class="fn"><a name="clear"></a><span class="type">void</span> QString::<span class="name">clear</span> ()</h3>
<p>Clears the contents of the string and makes it empty.</p>
<p><b>See also </b><a href="qstring.html#resize">resize</a>() and <a href="qstring.html#isEmpty">isEmpty</a>().</p>
<!-- @@@clear -->
<!-- $$$compare[overload1]$$$compareconstQString&constQString&Qt::CaseSensitivity -->
<h3 class="fn"><a name="compare"></a><span class="type">int</span> QString::<span class="name">compare</span> ( const <span class="type">QString</span> &amp; <i>s1</i>, const <span class="type">QString</span> &amp; <i>s2</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> )<tt> [static]</tt></h3>
<p>Compares <i>s1</i> with <i>s2</i> and returns an integer less than, equal to, or greater than zero if <i>s1</i> is less than, equal to, or greater than <i>s2</i>.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a>, the comparison is case sensitive; otherwise the comparison is case insensitive.</p>
<p>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. Consider sorting user-visible strings with <a href="qstring.html#localeAwareCompare">localeAwareCompare</a>().</p>
<pre class="cpp"> <span class="type">int</span> x <span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span><span class="operator">::</span>compare(<span class="string">&quot;aUtO&quot;</span><span class="operator">,</span> <span class="string">&quot;AuTo&quot;</span><span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>CaseInsensitive);  <span class="comment">// x == 0</span>
 <span class="type">int</span> y <span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span><span class="operator">::</span>compare(<span class="string">&quot;auto&quot;</span><span class="operator">,</span> <span class="string">&quot;Car&quot;</span><span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>CaseSensitive);     <span class="comment">// y &gt; 0</span>
 <span class="type">int</span> z <span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span><span class="operator">::</span>compare(<span class="string">&quot;auto&quot;</span><span class="operator">,</span> <span class="string">&quot;Car&quot;</span><span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>CaseInsensitive);   <span class="comment">// z &lt; 0</span></pre>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstring.html#operator-eq-eq">operator==</a>(), <a href="qstring.html#operator-lt">operator&lt;</a>(), and <a href="qstring.html#operator-gt">operator&gt;</a>().</p>
<!-- @@@compare -->
<!-- $$$compare$$$compareconstQString&constQString& -->
<h3 class="fn"><a name="compare-2"></a><span class="type">int</span> QString::<span class="name">compare</span> ( const <span class="type">QString</span> &amp; <i>s1</i>, const <span class="type">QString</span> &amp; <i>s2</i> )<tt> [static]</tt></h3>
<p>This function overloads <a href="qstring.html#compare">compare</a>().</p>
<p>Performs a case sensitive compare of <i>s1</i> and <i>s2</i>.</p>
<!-- @@@compare -->
<!-- $$$compare$$$compareconstQString&constQLatin1String&Qt::CaseSensitivity -->
<h3 class="fn"><a name="compare-3"></a><span class="type">int</span> QString::<span class="name">compare</span> ( const <span class="type">QString</span> &amp; <i>s1</i>, const <span class="type"><a href="qlatin1string.html">QLatin1String</a></span> &amp; <i>s2</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive )<tt> [static]</tt></h3>
<p>This function overloads <a href="qstring.html#compare">compare</a>().</p>
<p>Performs a comparison of <i>s1</i> and <i>s2</i>, using the case sensitivity setting <i>cs</i>.</p>
<p>This function was introduced in Qt 4.2.</p>
<!-- @@@compare -->
<!-- $$$compare$$$compareconstQLatin1String&constQString&Qt::CaseSensitivity -->
<h3 class="fn"><a name="compare-4"></a><span class="type">int</span> QString::<span class="name">compare</span> ( const <span class="type"><a href="qlatin1string.html">QLatin1String</a></span> &amp; <i>s1</i>, const <span class="type">QString</span> &amp; <i>s2</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive )<tt> [static]</tt></h3>
<p>This function overloads <a href="qstring.html#compare">compare</a>().</p>
<p>Performs a comparison of <i>s1</i> and <i>s2</i>, using the case sensitivity setting <i>cs</i>.</p>
<p>This function was introduced in Qt 4.2.</p>
<!-- @@@compare -->
<!-- $$$compare$$$compareconstQString& -->
<h3 class="fn"><a name="compare-5"></a><span class="type">int</span> QString::<span class="name">compare</span> ( const <span class="type">QString</span> &amp; <i>other</i> ) const</h3>
<p>This function overloads <a href="qstring.html#compare">compare</a>().</p>
<p>Lexically compares this string with the <i>other</i> string and returns an integer less than, equal to, or greater than zero if this string is less than, equal to, or greater than the other string.</p>
<p>Equivalent to <tt>compare(*this, other)</tt>.</p>
<!-- @@@compare -->
<!-- $$$compare$$$compareconstQString&Qt::CaseSensitivity -->
<h3 class="fn"><a name="compare-6"></a><span class="type">int</span> QString::<span class="name">compare</span> ( const <span class="type">QString</span> &amp; <i>other</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> ) const</h3>
<p>This function overloads <a href="qstring.html#compare">compare</a>().</p>
<p>Same as compare(*this, <i>other</i>, <i>cs</i>).</p>
<p>This function was introduced in Qt 4.2.</p>
<!-- @@@compare -->
<!-- $$$compare$$$compareconstQLatin1String&Qt::CaseSensitivity -->
<h3 class="fn"><a name="compare-7"></a><span class="type">int</span> QString::<span class="name">compare</span> ( const <span class="type"><a href="qlatin1string.html">QLatin1String</a></span> &amp; <i>other</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>This function overloads <a href="qstring.html#compare">compare</a>().</p>
<p>Same as compare(*this, <i>other</i>, <i>cs</i>).</p>
<p>This function was introduced in Qt 4.2.</p>
<!-- @@@compare -->
<!-- $$$compare$$$compareconstQStringRef&Qt::CaseSensitivity -->
<h3 class="fn"><a name="compare-8"></a><span class="type">int</span> QString::<span class="name">compare</span> ( const <span class="type"><a href="qstringref.html">QStringRef</a></span> &amp; <i>ref</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>This function overloads <a href="qstring.html#compare">compare</a>().</p>
<p>Compares the string reference, <i>ref</i>, with the string and returns an integer less than, equal to, or greater than zero if the string is less than, equal to, or greater than <i>ref</i>.</p>
<!-- @@@compare -->
<!-- $$$compare$$$compareconstQString&constQStringRef&Qt::CaseSensitivity -->
<h3 class="fn"><a name="compare-9"></a><span class="type">int</span> QString::<span class="name">compare</span> ( const <span class="type">QString</span> &amp; <i>s1</i>, const <span class="type"><a href="qstringref.html">QStringRef</a></span> &amp; <i>s2</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive )<tt> [static]</tt></h3>
<p>This function overloads <a href="qstring.html#compare">compare</a>().</p>
<!-- @@@compare -->
<!-- $$$constBegin[overload1]$$$constBegin -->
<h3 class="fn"><a name="constBegin"></a><span class="type"><a href="qstring.html#const_iterator-typedef">const_iterator</a></span> QString::<span class="name">constBegin</span> () const</h3>
<p>Returns a const <a href="containers.html#stl-style-iterators">STL-style iterator</a> pointing to the first character in the string.</p>
<p><b>See also </b><a href="qstring.html#begin">begin</a>() and <a href="qstring.html#constEnd">constEnd</a>().</p>
<!-- @@@constBegin -->
<!-- $$$constData[overload1]$$$constData -->
<h3 class="fn"><a name="constData"></a>const <span class="type"><a href="qchar.html">QChar</a></span> * QString::<span class="name">constData</span> () const</h3>
<p>Returns a pointer to the data stored in the <a href="qstring.html">QString</a>. The pointer can be used to access the characters that compose the string. For convenience, the data is '\0'-terminated.</p>
<p>Note that the pointer remains valid only as long as the string is not modified.</p>
<p><b>See also </b><a href="qstring.html#data">data</a>() and <a href="qstring.html#operator-5b-5d">operator[]</a>().</p>
<!-- @@@constData -->
<!-- $$$constEnd[overload1]$$$constEnd -->
<h3 class="fn"><a name="constEnd"></a><span class="type"><a href="qstring.html#const_iterator-typedef">const_iterator</a></span> QString::<span class="name">constEnd</span> () const</h3>
<p>Returns a const <a href="containers.html#stl-style-iterators">STL-style iterator</a> pointing to the imaginary item after the last item in the list.</p>
<p><b>See also </b><a href="qstring.html#constBegin">constBegin</a>() and <a href="qstring.html#end">end</a>().</p>
<!-- @@@constEnd -->
<!-- $$$contains[overload1]$$$containsconstQString&Qt::CaseSensitivity -->
<h3 class="fn"><a name="contains"></a><span class="type">bool</span> QString::<span class="name">contains</span> ( const <span class="type">QString</span> &amp; <i>str</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>Returns true if this string contains an occurrence of the string <i>str</i>; otherwise returns false.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (default), the search is case sensitive; otherwise the search is case insensitive.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;Peter Pan&quot;</span>;
 str<span class="operator">.</span>contains(<span class="string">&quot;peter&quot;</span><span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>CaseInsensitive);    <span class="comment">// returns true</span></pre>
<p><b>See also </b><a href="qstring.html#indexOf">indexOf</a>() and <a href="qstring.html#count">count</a>().</p>
<!-- @@@contains -->
<!-- $$$contains$$$containsconstQStringRef&Qt::CaseSensitivity -->
<h3 class="fn"><a name="contains-2"></a><span class="type">bool</span> QString::<span class="name">contains</span> ( const <span class="type"><a href="qstringref.html">QStringRef</a></span> &amp; <i>str</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>Returns true if this string contains an occurrence of the string reference <i>str</i>; otherwise returns false.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (default), the search is case sensitive; otherwise the search is case insensitive.</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also </b><a href="qstring.html#indexOf">indexOf</a>() and <a href="qstring.html#count">count</a>().</p>
<!-- @@@contains -->
<!-- $$$contains$$$containsQCharQt::CaseSensitivity -->
<h3 class="fn"><a name="contains-5"></a><span class="type">bool</span> QString::<span class="name">contains</span> ( <span class="type"><a href="qchar.html">QChar</a></span> <i>ch</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>This function overloads <a href="qstring.html#contains">contains</a>().</p>
<p>Returns true if this string contains an occurrence of the character <i>ch</i>; otherwise returns false.</p>
<!-- @@@contains -->
<!-- $$$contains$$$containsconstQRegExp& -->
<h3 class="fn"><a name="contains-6"></a><span class="type">bool</span> QString::<span class="name">contains</span> ( const <span class="type"><a href="qregexp.html">QRegExp</a></span> &amp; <i>rx</i> ) const</h3>
<p>This function overloads <a href="qstring.html#contains">contains</a>().</p>
<p>Returns true if the regular expression <i>rx</i> matches somewhere in this string; otherwise returns false.</p>
<!-- @@@contains -->
<!-- $$$contains$$$containsQRegExp& -->
<h3 class="fn"><a name="contains-7"></a><span class="type">bool</span> QString::<span class="name">contains</span> ( <span class="type"><a href="qregexp.html">QRegExp</a></span> &amp; <i>rx</i> ) const</h3>
<p>This function overloads <a href="qstring.html#contains">contains</a>().</p>
<p>Returns true if the regular expression <i>rx</i> matches somewhere in this string; otherwise returns false.</p>
<p>If there is a match, the <i>rx</i> regular expression will contain the matched captures (see QRegExp::matchedLength, QRegExp::cap).</p>
<p>This function was introduced in Qt 4.5.</p>
<!-- @@@contains -->
<!-- $$$count[overload1]$$$countconstQString&Qt::CaseSensitivity -->
<h3 class="fn"><a name="count"></a><span class="type">int</span> QString::<span class="name">count</span> ( const <span class="type">QString</span> &amp; <i>str</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>Returns the number of (potentially overlapping) occurrences of the string <i>str</i> in this string.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (default), the search is case sensitive; otherwise the search is case insensitive.</p>
<p><b>See also </b><a href="qstring.html#contains">contains</a>() and <a href="qstring.html#indexOf">indexOf</a>().</p>
<!-- @@@count -->
<!-- $$$count$$$countQCharQt::CaseSensitivity -->
<h3 class="fn"><a name="count-2"></a><span class="type">int</span> QString::<span class="name">count</span> ( <span class="type"><a href="qchar.html">QChar</a></span> <i>ch</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>This function overloads <a href="qstring.html#count">count</a>().</p>
<p>Returns the number of occurrences of character <i>ch</i> in the string.</p>
<!-- @@@count -->
<!-- $$$count$$$countconstQStringRef&Qt::CaseSensitivity -->
<h3 class="fn"><a name="count-3"></a><span class="type">int</span> QString::<span class="name">count</span> ( const <span class="type"><a href="qstringref.html">QStringRef</a></span> &amp; <i>str</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>This function overloads <a href="qstring.html#count">count</a>().</p>
<p>Returns the number of (potentially overlapping) occurrences of the string reference <i>str</i> in this string.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (default), the search is case sensitive; otherwise the search is case insensitive.</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also </b><a href="qstring.html#contains">contains</a>() and <a href="qstring.html#indexOf">indexOf</a>().</p>
<!-- @@@count -->
<!-- $$$count$$$countconstQRegExp& -->
<h3 class="fn"><a name="count-4"></a><span class="type">int</span> QString::<span class="name">count</span> ( const <span class="type"><a href="qregexp.html">QRegExp</a></span> &amp; <i>rx</i> ) const</h3>
<p>This function overloads <a href="qstring.html#count">count</a>().</p>
<p>Returns the number of times the regular expression <i>rx</i> matches in the string.</p>
<p>This function counts overlapping matches, so in the example below, there are four instances of &quot;ana&quot; or &quot;ama&quot;:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;banana and panama&quot;</span>;
 str<span class="operator">.</span>count(<span class="type"><a href="qregexp.html">QRegExp</a></span>(<span class="string">&quot;a[nm]a&quot;</span>));    <span class="comment">// returns 4</span></pre>
<!-- @@@count -->
<!-- $$$count$$$count -->
<h3 class="fn"><a name="count-5"></a><span class="type">int</span> QString::<span class="name">count</span> () const</h3>
<p>This function overloads <a href="qstring.html#count">count</a>().</p>
<p>Same as <a href="qstring.html#size">size</a>().</p>
<!-- @@@count -->
<!-- $$$data[overload1]$$$data -->
<h3 class="fn"><a name="data"></a><span class="type"><a href="qchar.html">QChar</a></span> * QString::<span class="name">data</span> ()</h3>
<p>Returns a pointer to the data stored in the <a href="qstring.html">QString</a>. The pointer can be used to access and modify the characters that compose the string. For convenience, the data is '\0'-terminated.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;Hello world&quot;</span>;
 <span class="type"><a href="qchar.html">QChar</a></span> <span class="operator">*</span>data <span class="operator">=</span> str<span class="operator">.</span>data();
 <span class="keyword">while</span> (<span class="operator">!</span>data<span class="operator">-</span><span class="operator">&gt;</span>isNull()) {
     <a href="qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> data<span class="operator">-</span><span class="operator">&gt;</span>unicode();
     <span class="operator">+</span><span class="operator">+</span>data;
 }</pre>
<p>Note that the pointer remains valid only as long as the string is not modified by other means. For read-only access, <a href="qstring.html#constData">constData</a>() is faster because it never causes a <a href="implicit-sharing.html#deep-copy">deep copy</a> to occur.</p>
<p><b>See also </b><a href="qstring.html#constData">constData</a>() and <a href="qstring.html#operator-5b-5d">operator[]</a>().</p>
<!-- @@@data -->
<!-- $$$data$$$data -->
<h3 class="fn"><a name="data-2"></a>const <span class="type"><a href="qchar.html">QChar</a></span> * QString::<span class="name">data</span> () const</h3>
<p>This is an overloaded function.</p>
<!-- @@@data -->
<!-- $$$end[overload1]$$$end -->
<h3 class="fn"><a name="end"></a><span class="type"><a href="qstring.html#iterator-typedefx">iterator</a></span> QString::<span class="name">end</span> ()</h3>
<p>Returns an <a href="containers.html#stl-style-iterators">STL-style iterator</a> pointing to the imaginary character after the last character in the string.</p>
<p><b>See also </b><a href="qstring.html#begin">begin</a>() and <a href="qstring.html#constEnd">constEnd</a>().</p>
<!-- @@@end -->
<!-- $$$end$$$end -->
<h3 class="fn"><a name="end-2"></a><span class="type"><a href="qstring.html#const_iterator-typedef">const_iterator</a></span> QString::<span class="name">end</span> () const</h3>
<p>This function overloads <a href="qstring.html#end">end</a>().</p>
<!-- @@@end -->
<!-- $$$endsWith[overload1]$$$endsWithconstQString&Qt::CaseSensitivity -->
<h3 class="fn"><a name="endsWith"></a><span class="type">bool</span> QString::<span class="name">endsWith</span> ( const <span class="type">QString</span> &amp; <i>s</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>Returns true if the string ends with <i>s</i>; otherwise returns false.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (default), the search is case sensitive; otherwise the search is case insensitive.</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;Bananas&quot;</span>;
 str<span class="operator">.</span>endsWith(<span class="string">&quot;anas&quot;</span>);         <span class="comment">// returns true</span>
 str<span class="operator">.</span>endsWith(<span class="string">&quot;pple&quot;</span>);         <span class="comment">// returns false</span></pre>
<p><b>See also </b><a href="qstring.html#startsWith">startsWith</a>().</p>
<!-- @@@endsWith -->
<!-- $$$endsWith$$$endsWithconstQStringRef&Qt::CaseSensitivity -->
<h3 class="fn"><a name="endsWith-3"></a><span class="type">bool</span> QString::<span class="name">endsWith</span> ( const <span class="type"><a href="qstringref.html">QStringRef</a></span> &amp; <i>s</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>This function overloads <a href="qstring.html#endsWith">endsWith</a>().</p>
<p>Returns true if the string ends with the string reference <i>s</i>; otherwise returns false.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (default), the search is case sensitive; otherwise the search is case insensitive.</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also </b><a href="qstring.html#startsWith">startsWith</a>().</p>
<!-- @@@endsWith -->
<!-- $$$endsWith$$$endsWithconstQLatin1String&Qt::CaseSensitivity -->
<h3 class="fn"><a name="endsWith-4"></a><span class="type">bool</span> QString::<span class="name">endsWith</span> ( const <span class="type"><a href="qlatin1string.html">QLatin1String</a></span> &amp; <i>s</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>This function overloads <a href="qstring.html#endsWith">endsWith</a>().</p>
<!-- @@@endsWith -->
<!-- $$$endsWith$$$endsWithconstQChar&Qt::CaseSensitivity -->
<h3 class="fn"><a name="endsWith-5"></a><span class="type">bool</span> QString::<span class="name">endsWith</span> ( const <span class="type"><a href="qchar.html">QChar</a></span> &amp; <i>c</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>Returns true if the string ends with <i>c</i>; otherwise returns false.</p>
<p>This function overloads <a href="qstring.html#endsWith">endsWith</a>().</p>
<!-- @@@endsWith -->
<!-- $$$fill[overload1]$$$fillQCharint -->
<h3 class="fn"><a name="fill"></a><span class="type">QString</span> &amp; QString::<span class="name">fill</span> ( <span class="type"><a href="qchar.html">QChar</a></span> <i>ch</i>, <span class="type">int</span> <i>size</i> = -1 )</h3>
<p>Sets every character in the string to character <i>ch</i>. If <i>size</i> is different from -1 (default), the string is resized to <i>size</i> beforehand.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;Berlin&quot;</span>;
 str<span class="operator">.</span>fill(<span class="char">'z'</span>);
 <span class="comment">// str == &quot;zzzzzz&quot;</span>

 str<span class="operator">.</span>fill(<span class="char">'A'</span><span class="operator">,</span> <span class="number">2</span>);
 <span class="comment">// str == &quot;AA&quot;</span></pre>
<p><b>See also </b><a href="qstring.html#resize">resize</a>().</p>
<!-- @@@fill -->
<!-- $$$fromAscii[overload1]$$$fromAsciiconstchar*int -->
<h3 class="fn"><a name="fromAscii"></a><span class="type">QString</span> QString::<span class="name">fromAscii</span> ( const <span class="type">char</span> * <i>str</i>, <span class="type">int</span> <i>size</i> = -1 )<tt> [static]</tt></h3>
<p>Returns a <a href="qstring.html">QString</a> initialized with the first <i>size</i> characters from the string <i>str</i>.</p>
<p>If <i>size</i> is -1 (default), it is taken to be qstrlen(<i>str</i>).</p>
<p>Note that, despite the name, this function actually uses the codec defined by <a href="qtextcodec.html#setCodecForCStrings">QTextCodec::setCodecForCStrings</a>() to convert <i>str</i> to Unicode. Depending on the codec, it may not accept valid US-ASCII (ANSI X3.4-1986) input. If no codec has been set, this function does the same as <a href="qstring.html#fromLatin1">fromLatin1</a>().</p>
<p><b>See also </b><a href="qstring.html#toAscii">toAscii</a>(), <a href="qstring.html#fromLatin1">fromLatin1</a>(), <a href="qstring.html#fromUtf8">fromUtf8</a>(), and <a href="qstring.html#fromLocal8Bit">fromLocal8Bit</a>().</p>
<!-- @@@fromAscii -->
<!-- $$$fromLatin1[overload1]$$$fromLatin1constchar*int -->
<h3 class="fn"><a name="fromLatin1"></a><span class="type">QString</span> QString::<span class="name">fromLatin1</span> ( const <span class="type">char</span> * <i>str</i>, <span class="type">int</span> <i>size</i> = -1 )<tt> [static]</tt></h3>
<p>Returns a <a href="qstring.html">QString</a> initialized with the first <i>size</i> characters of the Latin-1 string <i>str</i>.</p>
<p>If <i>size</i> is -1 (default), it is taken to be qstrlen(<i>str</i>).</p>
<p><b>See also </b><a href="qstring.html#toLatin1">toLatin1</a>(), <a href="qstring.html#fromAscii">fromAscii</a>(), <a href="qstring.html#fromUtf8">fromUtf8</a>(), and <a href="qstring.html#fromLocal8Bit">fromLocal8Bit</a>().</p>
<!-- @@@fromLatin1 -->
<!-- $$$fromLocal8Bit[overload1]$$$fromLocal8Bitconstchar*int -->
<h3 class="fn"><a name="fromLocal8Bit"></a><span class="type">QString</span> QString::<span class="name">fromLocal8Bit</span> ( const <span class="type">char</span> * <i>str</i>, <span class="type">int</span> <i>size</i> = -1 )<tt> [static]</tt></h3>
<p>Returns a <a href="qstring.html">QString</a> initialized with the first <i>size</i> characters of the 8-bit string <i>str</i>.</p>
<p>If <i>size</i> is -1 (default), it is taken to be qstrlen(<i>str</i>).</p>
<p><a href="qtextcodec.html#codecForLocale">QTextCodec::codecForLocale</a>() is used to perform the conversion.</p>
<p><b>See also </b><a href="qstring.html#toLocal8Bit">toLocal8Bit</a>(), <a href="qstring.html#fromAscii">fromAscii</a>(), <a href="qstring.html#fromLatin1">fromLatin1</a>(), and <a href="qstring.html#fromUtf8">fromUtf8</a>().</p>
<!-- @@@fromLocal8Bit -->
<!-- $$$fromRawData[overload1]$$$fromRawDataconstQChar*int -->
<h3 class="fn"><a name="fromRawData"></a><span class="type">QString</span> QString::<span class="name">fromRawData</span> ( const <span class="type"><a href="qchar.html">QChar</a></span> * <i>unicode</i>, <span class="type">int</span> <i>size</i> )<tt> [static]</tt></h3>
<p>Constructs a <a href="qstring.html">QString</a> that uses the first <i>size</i> Unicode characters in the array <i>unicode</i>. The data in <i>unicode</i> is <i>not</i> copied. The caller must be able to guarantee that <i>unicode</i> will not be deleted or modified as long as the <a href="qstring.html">QString</a> (or an unmodified copy of it) exists.</p>
<p>Any attempts to modify the <a href="qstring.html">QString</a> or copies of it will cause it to create a deep copy of the data, ensuring that the raw data isn't modified.</p>
<p>Here's an example of how we can use a <a href="qregexp.html">QRegExp</a> on raw data in memory without requiring to copy the data into a <a href="qstring.html">QString</a>:</p>
<pre class="cpp"> <span class="type"><a href="qregexp.html">QRegExp</a></span> pattern;
 <span class="keyword">static</span> <span class="keyword">const</span> <span class="type"><a href="qchar.html">QChar</a></span> unicode<span class="operator">[</span><span class="operator">]</span> <span class="operator">=</span> {
         <span class="number">0x005A</span><span class="operator">,</span> <span class="number">0x007F</span><span class="operator">,</span> <span class="number">0x00A4</span><span class="operator">,</span> <span class="number">0x0060</span><span class="operator">,</span>
         <span class="number">0x1009</span><span class="operator">,</span> <span class="number">0x0020</span><span class="operator">,</span> <span class="number">0x0020</span>};
 <span class="type">int</span> size <span class="operator">=</span> <span class="keyword">sizeof</span>(unicode) <span class="operator">/</span> <span class="keyword">sizeof</span>(<span class="type"><a href="qchar.html">QChar</a></span>);

 <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span><span class="operator">::</span>fromRawData(unicode<span class="operator">,</span> size);
 <span class="keyword">if</span> (str<span class="operator">.</span>contains(<span class="type"><a href="qregexp.html">QRegExp</a></span>(pattern))) {
     <span class="comment">// ...</span>
 }</pre>
<p><b>Warning:</b> A string created with fromRawData() is <i>not</i> '\0'-terminated, unless the raw data contains a '\0' character at position <i>size</i>. This means <a href="qstring.html#unicode">unicode</a>() will <i>not</i> return a '\0'-terminated string (although <a href="qstring.html#utf16">utf16</a>() does, at the cost of copying the raw data).</p>
<p><b>See also </b><a href="qstring.html#fromUtf16">fromUtf16</a>() and <a href="qstring.html#setRawData">setRawData</a>().</p>
<!-- @@@fromRawData -->
<!-- $$$fromStdString[overload1]$$$fromStdStringconststd::string& -->
<h3 class="fn"><a name="fromStdString"></a><span class="type">QString</span> QString::<span class="name">fromStdString</span> ( const <span class="type">std::string</span> &amp; <i>str</i> )<tt> [static]</tt></h3>
<p>Returns a copy of the <i>str</i> string. The given string is converted to Unicode using the <a href="qstring.html#fromAscii">fromAscii</a>() function.</p>
<p>This constructor is only available if Qt is configured with STL compatibility enabled.</p>
<p><b>See also </b><a href="qstring.html#fromAscii">fromAscii</a>(), <a href="qstring.html#fromLatin1">fromLatin1</a>(), <a href="qstring.html#fromLocal8Bit">fromLocal8Bit</a>(), and <a href="qstring.html#fromUtf8">fromUtf8</a>().</p>
<!-- @@@fromStdString -->
<!-- $$$fromStdWString[overload1]$$$fromStdWStringconststd::wstring& -->
<h3 class="fn"><a name="fromStdWString"></a><span class="type">QString</span> QString::<span class="name">fromStdWString</span> ( const <span class="type">std::wstring</span> &amp; <i>str</i> )<tt> [static]</tt></h3>
<p>Returns a copy of the <i>str</i> string. The given string is assumed to be encoded in utf16 if the size of wchar_t is 2 bytes (e.g&#x2e; on windows) and ucs4 if the size of wchar_t is 4 bytes (most Unix systems).</p>
<p>This method is only available if Qt is configured with STL compatibility enabled.</p>
<p><b>See also </b><a href="qstring.html#fromUtf16">fromUtf16</a>(), <a href="qstring.html#fromLatin1">fromLatin1</a>(), <a href="qstring.html#fromLocal8Bit">fromLocal8Bit</a>(), <a href="qstring.html#fromUtf8">fromUtf8</a>(), and <a href="qstring.html#fromUcs4">fromUcs4</a>().</p>
<!-- @@@fromStdWString -->
<!-- $$$fromUcs4[overload1]$$$fromUcs4constuint*int -->
<h3 class="fn"><a name="fromUcs4"></a><span class="type">QString</span> QString::<span class="name">fromUcs4</span> ( const <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> * <i>unicode</i>, <span class="type">int</span> <i>size</i> = -1 )<tt> [static]</tt></h3>
<p>Returns a <a href="qstring.html">QString</a> initialized with the first <i>size</i> characters of the Unicode string <i>unicode</i> (ISO-10646-UCS-4 encoded).</p>
<p>If <i>size</i> is -1 (default), <i>unicode</i> must be terminated with a 0.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstring.html#toUcs4">toUcs4</a>(), <a href="qstring.html#fromUtf16">fromUtf16</a>(), <a href="qstring.html#utf16">utf16</a>(), <a href="qstring.html#setUtf16">setUtf16</a>(), and <a href="qstring.html#fromWCharArray">fromWCharArray</a>().</p>
<!-- @@@fromUcs4 -->
<!-- $$$fromUtf8[overload1]$$$fromUtf8constchar*int -->
<h3 class="fn"><a name="fromUtf8"></a><span class="type">QString</span> QString::<span class="name">fromUtf8</span> ( const <span class="type">char</span> * <i>str</i>, <span class="type">int</span> <i>size</i> = -1 )<tt> [static]</tt></h3>
<p>Returns a <a href="qstring.html">QString</a> initialized with the first <i>size</i> bytes of the UTF-8 string <i>str</i>.</p>
<p>If <i>size</i> is -1 (default), it is taken to be qstrlen(<i>str</i>).</p>
<p>UTF-8 is a Unicode codec and can represent all characters in a Unicode string like <a href="qstring.html">QString</a>. However, invalid sequences are possible with UTF-8 and, if any such are found, they will be replaced with one or more &quot;replacement characters&quot;, or suppressed. These include non-Unicode sequences, non-characters, overlong sequences or surrogate codepoints encoded into UTF-8.</p>
<p>Non-characters are codepoints that the Unicode standard reserves and must not be used in text interchange. They are the last two codepoints in each Unicode Plane (U+FFFE, U+FFFF, U+1FFFE, U+1FFFF, U+2FFFE, etc.), as well as 16 codepoints in the range U+FDD0..U+FDDF, inclusive.</p>
<p><b>See also </b><a href="qstring.html#toUtf8">toUtf8</a>(), <a href="qstring.html#fromAscii">fromAscii</a>(), <a href="qstring.html#fromLatin1">fromLatin1</a>(), and <a href="qstring.html#fromLocal8Bit">fromLocal8Bit</a>().</p>
<!-- @@@fromUtf8 -->
<!-- $$$fromUtf16[overload1]$$$fromUtf16constushort*int -->
<h3 class="fn"><a name="fromUtf16"></a><span class="type">QString</span> QString::<span class="name">fromUtf16</span> ( const <span class="type"><a href="qtglobal.html#ushort-typedef">ushort</a></span> * <i>unicode</i>, <span class="type">int</span> <i>size</i> = -1 )<tt> [static]</tt></h3>
<p>Returns a <a href="qstring.html">QString</a> initialized with the first <i>size</i> characters of the Unicode string <i>unicode</i> (ISO-10646-UTF-16 encoded).</p>
<p>If <i>size</i> is -1 (default), <i>unicode</i> must be terminated with a 0.</p>
<p>This function checks for a Byte Order Mark (BOM). If it is missing, host byte order is assumed.</p>
<p>This function is slow compared to the other Unicode conversions. Use <a href="qstring.html">QString</a>(const <a href="qchar.html">QChar</a> *, int) or <a href="qstring.html">QString</a>(const <a href="qchar.html">QChar</a> *) if possible.</p>
<p><a href="qstring.html">QString</a> makes a deep copy of the Unicode data.</p>
<p><b>See also </b><a href="qstring.html#utf16">utf16</a>() and <a href="qstring.html#setUtf16">setUtf16</a>().</p>
<!-- @@@fromUtf16 -->
<!-- $$$fromWCharArray[overload1]$$$fromWCharArrayconstwchar_t*int -->
<h3 class="fn"><a name="fromWCharArray"></a><span class="type">QString</span> QString::<span class="name">fromWCharArray</span> ( const <span class="type">wchar_t</span> * <i>string</i>, <span class="type">int</span> <i>size</i> = -1 )<tt> [static]</tt></h3>
<p>Returns a copy of the <i>string</i>, where the encoding of <i>string</i> depends on the size of wchar. If wchar is 4 bytes, the <i>string</i> is interpreted as ucs-4, if wchar is 2 bytes it is interpreted as ucs-2.</p>
<p>If <i>size</i> is -1 (default), the <i>string</i> has to be 0 terminated.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstring.html#fromUtf16">fromUtf16</a>(), <a href="qstring.html#fromLatin1">fromLatin1</a>(), <a href="qstring.html#fromLocal8Bit">fromLocal8Bit</a>(), <a href="qstring.html#fromUtf8">fromUtf8</a>(), <a href="qstring.html#fromUcs4">fromUcs4</a>(), and <a href="qstring.html#fromStdWString">fromStdWString</a>().</p>
<!-- @@@fromWCharArray -->
<!-- $$$indexOf[overload1]$$$indexOfconstQString&intQt::CaseSensitivity -->
<h3 class="fn"><a name="indexOf"></a><span class="type">int</span> QString::<span class="name">indexOf</span> ( const <span class="type">QString</span> &amp; <i>str</i>, <span class="type">int</span> <i>from</i> = 0, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>Returns the index position of the first occurrence of the string <i>str</i> in this string, searching forward from index position <i>from</i>. Returns -1 if <i>str</i> is not found.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (default), the search is case sensitive; otherwise the search is case insensitive.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> x <span class="operator">=</span> <span class="string">&quot;sticky question&quot;</span>;
 <span class="type"><a href="qstring.html">QString</a></span> y <span class="operator">=</span> <span class="string">&quot;sti&quot;</span>;
 x<span class="operator">.</span>indexOf(y);               <span class="comment">// returns 0</span>
 x<span class="operator">.</span>indexOf(y<span class="operator">,</span> <span class="number">1</span>);            <span class="comment">// returns 10</span>
 x<span class="operator">.</span>indexOf(y<span class="operator">,</span> <span class="number">10</span>);           <span class="comment">// returns 10</span>
 x<span class="operator">.</span>indexOf(y<span class="operator">,</span> <span class="number">11</span>);           <span class="comment">// returns -1</span></pre>
<p>If <i>from</i> is -1, the search starts at the last character; if it is -2, at the next to last character and so on.</p>
<p><b>See also </b><a href="qstring.html#lastIndexOf">lastIndexOf</a>(), <a href="qstring.html#contains">contains</a>(), and <a href="qstring.html#count">count</a>().</p>
<!-- @@@indexOf -->
<!-- $$$indexOf$$$indexOfconstQLatin1String&intQt::CaseSensitivity -->
<h3 class="fn"><a name="indexOf-2"></a><span class="type">int</span> QString::<span class="name">indexOf</span> ( const <span class="type"><a href="qlatin1string.html">QLatin1String</a></span> &amp; <i>str</i>, <span class="type">int</span> <i>from</i> = 0, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>Returns the index position of the first occurrence of the string <i>str</i> in this string, searching forward from index position <i>from</i>. Returns -1 if <i>str</i> is not found.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (default), the search is case sensitive; otherwise the search is case insensitive.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> x <span class="operator">=</span> <span class="string">&quot;sticky question&quot;</span>;
 <span class="type"><a href="qstring.html">QString</a></span> y <span class="operator">=</span> <span class="string">&quot;sti&quot;</span>;
 x<span class="operator">.</span>indexOf(y);               <span class="comment">// returns 0</span>
 x<span class="operator">.</span>indexOf(y<span class="operator">,</span> <span class="number">1</span>);            <span class="comment">// returns 10</span>
 x<span class="operator">.</span>indexOf(y<span class="operator">,</span> <span class="number">10</span>);           <span class="comment">// returns 10</span>
 x<span class="operator">.</span>indexOf(y<span class="operator">,</span> <span class="number">11</span>);           <span class="comment">// returns -1</span></pre>
<p>If <i>from</i> is -1, the search starts at the last character; if it is -2, at the next to last character and so on.</p>
<p>This function was introduced in Qt 4.5.</p>
<p><b>See also </b><a href="qstring.html#lastIndexOf">lastIndexOf</a>(), <a href="qstring.html#contains">contains</a>(), and <a href="qstring.html#count">count</a>().</p>
<!-- @@@indexOf -->
<!-- $$$indexOf$$$indexOfQCharintQt::CaseSensitivity -->
<h3 class="fn"><a name="indexOf-3"></a><span class="type">int</span> QString::<span class="name">indexOf</span> ( <span class="type"><a href="qchar.html">QChar</a></span> <i>ch</i>, <span class="type">int</span> <i>from</i> = 0, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>This function overloads <a href="qstring.html#indexOf">indexOf</a>().</p>
<p>Returns the index position of the first occurrence of the character <i>ch</i> in the string, searching forward from index position <i>from</i>. Returns -1 if <i>ch</i> could not be found.</p>
<!-- @@@indexOf -->
<!-- $$$indexOf$$$indexOfconstQStringRef&intQt::CaseSensitivity -->
<h3 class="fn"><a name="indexOf-4"></a><span class="type">int</span> QString::<span class="name">indexOf</span> ( const <span class="type"><a href="qstringref.html">QStringRef</a></span> &amp; <i>str</i>, <span class="type">int</span> <i>from</i> = 0, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>This function overloads <a href="qstring.html#indexOf">indexOf</a>().</p>
<p>Returns the index position of the first occurrence of the string reference <i>str</i> in this string, searching forward from index position <i>from</i>. Returns -1 if <i>str</i> is not found.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (default), the search is case sensitive; otherwise the search is case insensitive.</p>
<p>This function was introduced in Qt 4.8.</p>
<!-- @@@indexOf -->
<!-- $$$indexOf$$$indexOfconstQRegExp&int -->
<h3 class="fn"><a name="indexOf-5"></a><span class="type">int</span> QString::<span class="name">indexOf</span> ( const <span class="type"><a href="qregexp.html">QRegExp</a></span> &amp; <i>rx</i>, <span class="type">int</span> <i>from</i> = 0 ) const</h3>
<p>This function overloads <a href="qstring.html#indexOf">indexOf</a>().</p>
<p>Returns the index position of the first match of the regular expression <i>rx</i> in the string, searching forward from index position <i>from</i>. Returns -1 if <i>rx</i> didn't match anywhere.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;the minimum&quot;</span>;
 str<span class="operator">.</span>indexOf(<span class="type"><a href="qregexp.html">QRegExp</a></span>(<span class="string">&quot;m[aeiou]&quot;</span>)<span class="operator">,</span> <span class="number">0</span>);       <span class="comment">// returns 4</span></pre>
<!-- @@@indexOf -->
<!-- $$$indexOf$$$indexOfQRegExp&int -->
<h3 class="fn"><a name="indexOf-6"></a><span class="type">int</span> QString::<span class="name">indexOf</span> ( <span class="type"><a href="qregexp.html">QRegExp</a></span> &amp; <i>rx</i>, <span class="type">int</span> <i>from</i> = 0 ) const</h3>
<p>This function overloads <a href="qstring.html#indexOf">indexOf</a>().</p>
<p>Returns the index position of the first match of the regular expression <i>rx</i> in the string, searching forward from index position <i>from</i>. Returns -1 if <i>rx</i> didn't match anywhere.</p>
<p>If there is a match, the <i>rx</i> regular expression will contain the matched captures (see QRegExp::matchedLength, QRegExp::cap).</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;the minimum&quot;</span>;
 str<span class="operator">.</span>indexOf(<span class="type"><a href="qregexp.html">QRegExp</a></span>(<span class="string">&quot;m[aeiou]&quot;</span>)<span class="operator">,</span> <span class="number">0</span>);       <span class="comment">// returns 4</span></pre>
<p>This function was introduced in Qt 4.5.</p>
<!-- @@@indexOf -->
<!-- $$$insert[overload1]$$$insertintconstQString& -->
<h3 class="fn"><a name="insert"></a><span class="type">QString</span> &amp; QString::<span class="name">insert</span> ( <span class="type">int</span> <i>position</i>, const <span class="type">QString</span> &amp; <i>str</i> )</h3>
<p>Inserts the string <i>str</i> at the given index <i>position</i> and returns a reference to this string.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;Meal&quot;</span>;
 str<span class="operator">.</span>insert(<span class="number">1</span><span class="operator">,</span> <span class="type"><a href="qstring.html">QString</a></span>(<span class="string">&quot;ontr&quot;</span>));
 <span class="comment">// str == &quot;Montreal&quot;</span></pre>
<p>If the given <i>position</i> is greater than <a href="qstring.html#size">size</a>(), the array is first extended using <a href="qstring.html#resize">resize</a>().</p>
<p><b>See also </b><a href="qstring.html#append">append</a>(), <a href="qstring.html#prepend">prepend</a>(), <a href="qstring.html#replace">replace</a>(), and <a href="qstring.html#remove">remove</a>().</p>
<!-- @@@insert -->
<!-- $$$insert$$$insertintconstQLatin1String& -->
<h3 class="fn"><a name="insert-2"></a><span class="type">QString</span> &amp; QString::<span class="name">insert</span> ( <span class="type">int</span> <i>position</i>, const <span class="type"><a href="qlatin1string.html">QLatin1String</a></span> &amp; <i>str</i> )</h3>
<p>This function overloads <a href="qstring.html#insert">insert</a>().</p>
<p>Inserts the Latin-1 string <i>str</i> at the given index <i>position</i>.</p>
<!-- @@@insert -->
<!-- $$$insert$$$insertintconstQChar*int -->
<h3 class="fn"><a name="insert-3"></a><span class="type">QString</span> &amp; QString::<span class="name">insert</span> ( <span class="type">int</span> <i>position</i>, const <span class="type"><a href="qchar.html">QChar</a></span> * <i>unicode</i>, <span class="type">int</span> <i>size</i> )</h3>
<p>This function overloads <a href="qstring.html#insert">insert</a>().</p>
<p>Inserts the first <i>size</i> characters of the <a href="qchar.html">QChar</a> array <i>unicode</i> at the given index <i>position</i> in the string.</p>
<!-- @@@insert -->
<!-- $$$insert$$$insertintQChar -->
<h3 class="fn"><a name="insert-4"></a><span class="type">QString</span> &amp; QString::<span class="name">insert</span> ( <span class="type">int</span> <i>position</i>, <span class="type"><a href="qchar.html">QChar</a></span> <i>ch</i> )</h3>
<p>This function overloads <a href="qstring.html#insert">insert</a>().</p>
<p>Inserts <i>ch</i> at the given index <i>position</i> in the string.</p>
<!-- @@@insert -->
<!-- $$$isEmpty[overload1]$$$isEmpty -->
<h3 class="fn"><a name="isEmpty"></a><span class="type">bool</span> QString::<span class="name">isEmpty</span> () const</h3>
<p>Returns true if the string has no characters; otherwise returns false.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span>()<span class="operator">.</span>isEmpty();            <span class="comment">// returns true</span>
 <span class="type"><a href="qstring.html">QString</a></span>(<span class="string">&quot;&quot;</span>)<span class="operator">.</span>isEmpty();          <span class="comment">// returns true</span>
 <span class="type"><a href="qstring.html">QString</a></span>(<span class="string">&quot;x&quot;</span>)<span class="operator">.</span>isEmpty();         <span class="comment">// returns false</span>
 <span class="type"><a href="qstring.html">QString</a></span>(<span class="string">&quot;abc&quot;</span>)<span class="operator">.</span>isEmpty();       <span class="comment">// returns false</span></pre>
<p><b>See also </b><a href="qstring.html#size">size</a>().</p>
<!-- @@@isEmpty -->
<!-- $$$isNull[overload1]$$$isNull -->
<h3 class="fn"><a name="isNull"></a><span class="type">bool</span> QString::<span class="name">isNull</span> () const</h3>
<p>Returns true if this string is null; otherwise returns false.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span>()<span class="operator">.</span>isNull();             <span class="comment">// returns true</span>
 <span class="type"><a href="qstring.html">QString</a></span>(<span class="string">&quot;&quot;</span>)<span class="operator">.</span>isNull();           <span class="comment">// returns false</span>
 <span class="type"><a href="qstring.html">QString</a></span>(<span class="string">&quot;abc&quot;</span>)<span class="operator">.</span>isNull();        <span class="comment">// returns false</span></pre>
<p>Qt makes a distinction between null strings and empty strings for historical reasons. For most applications, what matters is whether or not a string contains any data, and this can be determined using the <a href="qstring.html#isEmpty">isEmpty</a>() function.</p>
<p><b>See also </b><a href="qstring.html#isEmpty">isEmpty</a>().</p>
<!-- @@@isNull -->
<!-- $$$isRightToLeft[overload1]$$$isRightToLeft -->
<h3 class="fn"><a name="isRightToLeft"></a><span class="type">bool</span> QString::<span class="name">isRightToLeft</span> () const</h3>
<p>Returns true if the string is read right to left.</p>
<!-- @@@isRightToLeft -->
<!-- $$$lastIndexOf[overload1]$$$lastIndexOfconstQString&intQt::CaseSensitivity -->
<h3 class="fn"><a name="lastIndexOf"></a><span class="type">int</span> QString::<span class="name">lastIndexOf</span> ( const <span class="type">QString</span> &amp; <i>str</i>, <span class="type">int</span> <i>from</i> = -1, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>Returns the index position of the last occurrence of the string <i>str</i> in this string, searching backward from index position <i>from</i>. If <i>from</i> is -1 (default), the search starts at the last character; if <i>from</i> is -2, at the next to last character and so on. Returns -1 if <i>str</i> is not found.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (default), the search is case sensitive; otherwise the search is case insensitive.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> x <span class="operator">=</span> <span class="string">&quot;crazy azimuths&quot;</span>;
 <span class="type"><a href="qstring.html">QString</a></span> y <span class="operator">=</span> <span class="string">&quot;az&quot;</span>;
 x<span class="operator">.</span>lastIndexOf(y);           <span class="comment">// returns 6</span>
 x<span class="operator">.</span>lastIndexOf(y<span class="operator">,</span> <span class="number">6</span>);        <span class="comment">// returns 6</span>
 x<span class="operator">.</span>lastIndexOf(y<span class="operator">,</span> <span class="number">5</span>);        <span class="comment">// returns 2</span>
 x<span class="operator">.</span>lastIndexOf(y<span class="operator">,</span> <span class="number">1</span>);        <span class="comment">// returns -1</span></pre>
<p><b>See also </b><a href="qstring.html#indexOf">indexOf</a>(), <a href="qstring.html#contains">contains</a>(), and <a href="qstring.html#count">count</a>().</p>
<!-- @@@lastIndexOf -->
<!-- $$$lastIndexOf$$$lastIndexOfconstQLatin1String&intQt::CaseSensitivity -->
<h3 class="fn"><a name="lastIndexOf-2"></a><span class="type">int</span> QString::<span class="name">lastIndexOf</span> ( const <span class="type"><a href="qlatin1string.html">QLatin1String</a></span> &amp; <i>str</i>, <span class="type">int</span> <i>from</i> = -1, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>This function overloads <a href="qstring.html#lastIndexOf">lastIndexOf</a>().</p>
<p>Returns the index position of the last occurrence of the string <i>str</i> in this string, searching backward from index position <i>from</i>. If <i>from</i> is -1 (default), the search starts at the last character; if <i>from</i> is -2, at the next to last character and so on. Returns -1 if <i>str</i> is not found.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (default), the search is case sensitive; otherwise the search is case insensitive.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> x <span class="operator">=</span> <span class="string">&quot;crazy azimuths&quot;</span>;
 <span class="type"><a href="qstring.html">QString</a></span> y <span class="operator">=</span> <span class="string">&quot;az&quot;</span>;
 x<span class="operator">.</span>lastIndexOf(y);           <span class="comment">// returns 6</span>
 x<span class="operator">.</span>lastIndexOf(y<span class="operator">,</span> <span class="number">6</span>);        <span class="comment">// returns 6</span>
 x<span class="operator">.</span>lastIndexOf(y<span class="operator">,</span> <span class="number">5</span>);        <span class="comment">// returns 2</span>
 x<span class="operator">.</span>lastIndexOf(y<span class="operator">,</span> <span class="number">1</span>);        <span class="comment">// returns -1</span></pre>
<p>This function was introduced in Qt 4.5.</p>
<p><b>See also </b><a href="qstring.html#indexOf">indexOf</a>(), <a href="qstring.html#contains">contains</a>(), and <a href="qstring.html#count">count</a>().</p>
<!-- @@@lastIndexOf -->
<!-- $$$lastIndexOf$$$lastIndexOfQCharintQt::CaseSensitivity -->
<h3 class="fn"><a name="lastIndexOf-3"></a><span class="type">int</span> QString::<span class="name">lastIndexOf</span> ( <span class="type"><a href="qchar.html">QChar</a></span> <i>ch</i>, <span class="type">int</span> <i>from</i> = -1, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>This function overloads <a href="qstring.html#lastIndexOf">lastIndexOf</a>().</p>
<p>Returns the index position of the last occurrence of the character <i>ch</i>, searching backward from position <i>from</i>.</p>
<!-- @@@lastIndexOf -->
<!-- $$$lastIndexOf$$$lastIndexOfconstQStringRef&intQt::CaseSensitivity -->
<h3 class="fn"><a name="lastIndexOf-4"></a><span class="type">int</span> QString::<span class="name">lastIndexOf</span> ( const <span class="type"><a href="qstringref.html">QStringRef</a></span> &amp; <i>str</i>, <span class="type">int</span> <i>from</i> = -1, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>This function overloads <a href="qstring.html#lastIndexOf">lastIndexOf</a>().</p>
<p>Returns the index position of the last occurrence of the string reference <i>str</i> in this string, searching backward from index position <i>from</i>. If <i>from</i> is -1 (default), the search starts at the last character; if <i>from</i> is -2, at the next to last character and so on. Returns -1 if <i>str</i> is not found.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (default), the search is case sensitive; otherwise the search is case insensitive.</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also </b><a href="qstring.html#indexOf">indexOf</a>(), <a href="qstring.html#contains">contains</a>(), and <a href="qstring.html#count">count</a>().</p>
<!-- @@@lastIndexOf -->
<!-- $$$lastIndexOf$$$lastIndexOfconstQRegExp&int -->
<h3 class="fn"><a name="lastIndexOf-5"></a><span class="type">int</span> QString::<span class="name">lastIndexOf</span> ( const <span class="type"><a href="qregexp.html">QRegExp</a></span> &amp; <i>rx</i>, <span class="type">int</span> <i>from</i> = -1 ) const</h3>
<p>This function overloads <a href="qstring.html#lastIndexOf">lastIndexOf</a>().</p>
<p>Returns the index position of the last match of the regular expression <i>rx</i> in the string, searching backward from index position <i>from</i>. Returns -1 if <i>rx</i> didn't match anywhere.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;the minimum&quot;</span>;
 str<span class="operator">.</span>lastIndexOf(<span class="type"><a href="qregexp.html">QRegExp</a></span>(<span class="string">&quot;m[aeiou]&quot;</span>));      <span class="comment">// returns 8</span></pre>
<!-- @@@lastIndexOf -->
<!-- $$$lastIndexOf$$$lastIndexOfQRegExp&int -->
<h3 class="fn"><a name="lastIndexOf-6"></a><span class="type">int</span> QString::<span class="name">lastIndexOf</span> ( <span class="type"><a href="qregexp.html">QRegExp</a></span> &amp; <i>rx</i>, <span class="type">int</span> <i>from</i> = -1 ) const</h3>
<p>This function overloads <a href="qstring.html#lastIndexOf">lastIndexOf</a>().</p>
<p>Returns the index position of the last match of the regular expression <i>rx</i> in the string, searching backward from index position <i>from</i>. Returns -1 if <i>rx</i> didn't match anywhere.</p>
<p>If there is a match, the <i>rx</i> regular expression will contain the matched captures (see QRegExp::matchedLength, QRegExp::cap).</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;the minimum&quot;</span>;
 str<span class="operator">.</span>lastIndexOf(<span class="type"><a href="qregexp.html">QRegExp</a></span>(<span class="string">&quot;m[aeiou]&quot;</span>));      <span class="comment">// returns 8</span></pre>
<p>This function was introduced in Qt 4.5.</p>
<!-- @@@lastIndexOf -->
<!-- $$$left[overload1]$$$leftint -->
<h3 class="fn"><a name="left"></a><span class="type">QString</span> QString::<span class="name">left</span> ( <span class="type">int</span> <i>n</i> ) const</h3>
<p>Returns a substring that contains the <i>n</i> leftmost characters of the string.</p>
<p>The entire string is returned if <i>n</i> is greater than <a href="qstring.html#size">size</a>() or less than zero.</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> x <span class="operator">=</span> <span class="string">&quot;Pineapple&quot;</span>;
 <span class="type"><a href="qstring.html">QString</a></span> y <span class="operator">=</span> x<span class="operator">.</span>left(<span class="number">4</span>);      <span class="comment">// y == &quot;Pine&quot;</span></pre>
<p><b>See also </b><a href="qstring.html#right">right</a>(), <a href="qstring.html#mid">mid</a>(), and <a href="qstring.html#startsWith">startsWith</a>().</p>
<!-- @@@left -->
<!-- $$$leftJustified[overload1]$$$leftJustifiedintQCharbool -->
<h3 class="fn"><a name="leftJustified"></a><span class="type">QString</span> QString::<span class="name">leftJustified</span> ( <span class="type">int</span> <i>width</i>, <span class="type"><a href="qchar.html">QChar</a></span> <i>fill</i> = QLatin1Char( ' ' ), <span class="type">bool</span> <i>truncate</i> = false ) const</h3>
<p>Returns a string of size <i>width</i> that contains this string padded by the <i>fill</i> character.</p>
<p>If <i>truncate</i> is false and the <a href="qstring.html#size">size</a>() of the string is more than <i>width</i>, then the returned string is a copy of the string.</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> s <span class="operator">=</span> <span class="string">&quot;apple&quot;</span>;
 <span class="type"><a href="qstring.html">QString</a></span> t <span class="operator">=</span> s<span class="operator">.</span>leftJustified(<span class="number">8</span><span class="operator">,</span> <span class="char">'.'</span>);    <span class="comment">// t == &quot;apple...&quot;</span></pre>
<p>If <i>truncate</i> is true and the <a href="qstring.html#size">size</a>() of the string is more than <i>width</i>, then any characters in a copy of the string after position <i>width</i> are removed, and the copy is returned.</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;Pineapple&quot;</span>;
 str <span class="operator">=</span> str<span class="operator">.</span>leftJustified(<span class="number">5</span><span class="operator">,</span> <span class="char">'.'</span><span class="operator">,</span> <span class="keyword">true</span>);    <span class="comment">// str == &quot;Pinea&quot;</span></pre>
<p><b>See also </b><a href="qstring.html#rightJustified">rightJustified</a>().</p>
<!-- @@@leftJustified -->
<!-- $$$leftRef[overload1]$$$leftRefint -->
<h3 class="fn"><a name="leftRef"></a><span class="type"><a href="qstringref.html">QStringRef</a></span> QString::<span class="name">leftRef</span> ( <span class="type">int</span> <i>n</i> ) const</h3>
<p>Returns a substring reference to the <i>n</i> leftmost characters of the string.</p>
<p>If <i>n</i> is greater than <a href="qstring.html#size">size</a>() or less than zero, a reference to the entire string is returned.</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> x <span class="operator">=</span> <span class="string">&quot;Pineapple&quot;</span>;
 <span class="type"><a href="qstringref.html">QStringRef</a></span> y <span class="operator">=</span> x<span class="operator">.</span>leftRef(<span class="number">4</span>);        <span class="comment">// y == &quot;Pine&quot;</span></pre>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also </b><a href="qstring.html#left">left</a>(), <a href="qstring.html#rightRef">rightRef</a>(), <a href="qstring.html#midRef">midRef</a>(), and <a href="qstring.html#startsWith">startsWith</a>().</p>
<!-- @@@leftRef -->
<!-- $$$length[overload1]$$$length -->
<h3 class="fn"><a name="length"></a><span class="type">int</span> QString::<span class="name">length</span> () const</h3>
<p>Returns the number of characters in this string. Equivalent to <a href="qstring.html#size">size</a>().</p>
<p><b>See also </b><a href="qstring-qt3.html#setLength" class="compat">setLength</a>() and <a href="qstring.html#resize">resize</a>().</p>
<!-- @@@length -->
<!-- $$$localeAwareCompare[overload1]$$$localeAwareCompareconstQString&constQString& -->
<h3 class="fn"><a name="localeAwareCompare"></a><span class="type">int</span> QString::<span class="name">localeAwareCompare</span> ( const <span class="type">QString</span> &amp; <i>s1</i>, const <span class="type">QString</span> &amp; <i>s2</i> )<tt> [static]</tt></h3>
<p>Compares <i>s1</i> with <i>s2</i> and returns an integer less than, equal to, or greater than zero if <i>s1</i> is less than, equal to, or greater than <i>s2</i>.</p>
<p>The comparison is performed in a locale- and also platform-dependent manner. Use this function to present sorted lists of strings to the user.</p>
<p>On Mac OS X since Qt 4.3, this function compares according the &quot;Order for sorted lists&quot; setting in the International prefereces panel.</p>
<p><b>See also </b><a href="qstring.html#compare">compare</a>() and <a href="qtextcodec-qt3.html#locale" class="compat">QTextCodec::locale</a>().</p>
<!-- @@@localeAwareCompare -->
<!-- $$$localeAwareCompare$$$localeAwareCompareconstQStringRef& -->
<h3 class="fn"><a name="localeAwareCompare-2"></a><span class="type">int</span> QString::<span class="name">localeAwareCompare</span> ( const <span class="type"><a href="qstringref.html">QStringRef</a></span> &amp; <i>other</i> ) const</h3>
<p>This function overloads <a href="qstring.html#localeAwareCompare">localeAwareCompare</a>().</p>
<p>Compares this string with the <i>other</i> string and returns an integer less than, equal to, or greater than zero if this string is less than, equal to, or greater than the <i>other</i> string.</p>
<p>The comparison is performed in a locale- and also platform-dependent manner. Use this function to present sorted lists of strings to the user.</p>
<p>Same as <tt>localeAwareCompare(*this, other)</tt>.</p>
<p>This function was introduced in Qt 4.5.</p>
<!-- @@@localeAwareCompare -->
<!-- $$$localeAwareCompare$$$localeAwareCompareconstQString&constQStringRef& -->
<h3 class="fn"><a name="localeAwareCompare-3"></a><span class="type">int</span> QString::<span class="name">localeAwareCompare</span> ( const <span class="type">QString</span> &amp; <i>s1</i>, const <span class="type"><a href="qstringref.html">QStringRef</a></span> &amp; <i>s2</i> )<tt> [static]</tt></h3>
<p>This function overloads <a href="qstring.html#localeAwareCompare">localeAwareCompare</a>().</p>
<p>Compares <i>s1</i> with <i>s2</i> and returns an integer less than, equal to, or greater than zero if <i>s1</i> is less than, equal to, or greater than <i>s2</i>.</p>
<p>The comparison is performed in a locale- and also platform-dependent manner. Use this function to present sorted lists of strings to the user.</p>
<p>This function was introduced in Qt 4.5.</p>
<!-- @@@localeAwareCompare -->
<!-- $$$localeAwareCompare$$$localeAwareCompareconstQString& -->
<h3 class="fn"><a name="localeAwareCompare-4"></a><span class="type">int</span> QString::<span class="name">localeAwareCompare</span> ( const <span class="type">QString</span> &amp; <i>other</i> ) const</h3>
<p>This function overloads <a href="qstring.html#localeAwareCompare">localeAwareCompare</a>().</p>
<p>Compares this string with the <i>other</i> string and returns an integer less than, equal to, or greater than zero if this string is less than, equal to, or greater than the <i>other</i> string.</p>
<p>The comparison is performed in a locale- and also platform-dependent manner. Use this function to present sorted lists of strings to the user.</p>
<p>Same as <tt>localeAwareCompare(*this, other)</tt>.</p>
<!-- @@@localeAwareCompare -->
<!-- $$$mid[overload1]$$$midintint -->
<h3 class="fn"><a name="mid"></a><span class="type">QString</span> QString::<span class="name">mid</span> ( <span class="type">int</span> <i>position</i>, <span class="type">int</span> <i>n</i> = -1 ) const</h3>
<p>Returns a string that contains <i>n</i> characters of this string, starting at the specified <i>position</i> index.</p>
<p>Returns a null string if the <i>position</i> index exceeds the length of the string. If there are less than <i>n</i> characters available in the string starting at the given <i>position</i>, or if <i>n</i> is -1 (default), the function returns all characters that are available from the specified <i>position</i>.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> x <span class="operator">=</span> <span class="string">&quot;Nine pineapples&quot;</span>;
 <span class="type"><a href="qstring.html">QString</a></span> y <span class="operator">=</span> x<span class="operator">.</span>mid(<span class="number">5</span><span class="operator">,</span> <span class="number">4</span>);            <span class="comment">// y == &quot;pine&quot;</span>
 <span class="type"><a href="qstring.html">QString</a></span> z <span class="operator">=</span> x<span class="operator">.</span>mid(<span class="number">5</span>);               <span class="comment">// z == &quot;pineapples&quot;</span></pre>
<p><b>See also </b><a href="qstring.html#left">left</a>() and <a href="qstring.html#right">right</a>().</p>
<!-- @@@mid -->
<!-- $$$midRef[overload1]$$$midRefintint -->
<h3 class="fn"><a name="midRef"></a><span class="type"><a href="qstringref.html">QStringRef</a></span> QString::<span class="name">midRef</span> ( <span class="type">int</span> <i>position</i>, <span class="type">int</span> <i>n</i> = -1 ) const</h3>
<p>Returns a substring reference to <i>n</i> characters of this string, starting at the specified <i>position</i>.</p>
<p>If the <i>position</i> exceeds the length of the string, an empty reference is returned.</p>
<p>If there are less than <i>n</i> characters available in the string, starting at the given <i>position</i>, or if <i>n</i> is -1 (default), the function returns all characters from the specified <i>position</i> onwards.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> x <span class="operator">=</span> <span class="string">&quot;Nine pineapples&quot;</span>;
 <span class="type"><a href="qstringref.html">QStringRef</a></span> y <span class="operator">=</span> x<span class="operator">.</span>midRef(<span class="number">5</span><span class="operator">,</span> <span class="number">4</span>);      <span class="comment">// y == &quot;pine&quot;</span>
 <span class="type"><a href="qstringref.html">QStringRef</a></span> z <span class="operator">=</span> x<span class="operator">.</span>midRef(<span class="number">5</span>);         <span class="comment">// z == &quot;pineapples&quot;</span></pre>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also </b><a href="qstring.html#mid">mid</a>(), <a href="qstring.html#leftRef">leftRef</a>(), and <a href="qstring.html#rightRef">rightRef</a>().</p>
<!-- @@@midRef -->
<!-- $$$normalized[overload1]$$$normalizedNormalizationForm -->
<h3 class="fn"><a name="normalized"></a><span class="type">QString</span> QString::<span class="name">normalized</span> ( <span class="type"><a href="qstring.html#NormalizationForm-enum">NormalizationForm</a></span> <i>mode</i> ) const</h3>
<p>Returns the string in the given Unicode normalization <i>mode</i>.</p>
<!-- @@@normalized -->
<!-- $$$normalized$$$normalizedNormalizationFormQChar::UnicodeVersion -->
<h3 class="fn"><a name="normalized-2"></a><span class="type">QString</span> QString::<span class="name">normalized</span> ( <span class="type"><a href="qstring.html#NormalizationForm-enum">NormalizationForm</a></span> <i>mode</i>, <span class="type"><a href="qchar.html#UnicodeVersion-enum">QChar::UnicodeVersion</a></span> <i>version</i> ) const</h3>
<p>This is an overloaded function.</p>
<p>Returns the string in the given Unicode normalization <i>mode</i>, according to the given <i>version</i> of the Unicode standard.</p>
<!-- @@@normalized -->
<!-- $$$number[overload1]$$$numberlongint -->
<h3 class="fn"><a name="number"></a><span class="type">QString</span> QString::<span class="name">number</span> ( <span class="type">long</span> <i>n</i>, <span class="type">int</span> <i>base</i> = 10 )<tt> [static]</tt></h3>
<p>Returns a string equivalent of the number <i>n</i> according to the specified <i>base</i>.</p>
<p>The base is 10 by default and must be between 2 and 36. For bases other than 10, <i>n</i> is treated as an unsigned integer.</p>
<pre class="cpp"> <span class="type">long</span> a <span class="operator">=</span> <span class="number">63</span>;
 <span class="type"><a href="qstring.html">QString</a></span> s <span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span><span class="operator">::</span>number(a<span class="operator">,</span> <span class="number">16</span>);             <span class="comment">// s == &quot;3f&quot;</span>
 <span class="type"><a href="qstring.html">QString</a></span> t <span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span><span class="operator">::</span>number(a<span class="operator">,</span> <span class="number">16</span>)<span class="operator">.</span>toUpper();     <span class="comment">// t == &quot;3F&quot;</span></pre>
<p><b>See also </b><a href="qstring.html#setNum">setNum</a>().</p>
<!-- @@@number -->
<!-- $$$number$$$numberdoublecharint -->
<h3 class="fn"><a name="number-2"></a><span class="type">QString</span> QString::<span class="name">number</span> ( <span class="type">double</span> <i>n</i>, <span class="type">char</span> <i>format</i> = 'g', <span class="type">int</span> <i>precision</i> = 6 )<tt> [static]</tt></h3>
<p>Returns a string equivalent of the number <i>n</i>, formatted according to the specified <i>format</i> and <i>precision</i>. See <a href="qstring.html#argument-formats">Argument Formats</a> for details.</p>
<p>Unlike <a href="qlocale.html#toString">QLocale::toString</a>(), this function does not honor the user's locale settings.</p>
<p><b>See also </b><a href="qstring.html#setNum">setNum</a>() and <a href="qlocale.html#toString">QLocale::toString</a>().</p>
<!-- @@@number -->
<!-- $$$number$$$numberulongint -->
<h3 class="fn"><a name="number-3"></a><span class="type">QString</span> QString::<span class="name">number</span> ( <span class="type"><a href="qtglobal.html#ulong-typedef">ulong</a></span> <i>n</i>, <span class="type">int</span> <i>base</i> = 10 )<tt> [static]</tt></h3>
<p>This is an overloaded function.</p>
<!-- @@@number -->
<!-- $$$number$$$numberintint -->
<h3 class="fn"><a name="number-4"></a><span class="type">QString</span> QString::<span class="name">number</span> ( <span class="type">int</span> <i>n</i>, <span class="type">int</span> <i>base</i> = 10 )<tt> [static]</tt></h3>
<p>This is an overloaded function.</p>
<!-- @@@number -->
<!-- $$$number$$$numberuintint -->
<h3 class="fn"><a name="number-5"></a><span class="type">QString</span> QString::<span class="name">number</span> ( <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> <i>n</i>, <span class="type">int</span> <i>base</i> = 10 )<tt> [static]</tt></h3>
<p>This is an overloaded function.</p>
<!-- @@@number -->
<!-- $$$number$$$numberqlonglongint -->
<h3 class="fn"><a name="number-6"></a><span class="type">QString</span> QString::<span class="name">number</span> ( <span class="type"><a href="qtglobal.html#qlonglong-typedef">qlonglong</a></span> <i>n</i>, <span class="type">int</span> <i>base</i> = 10 )<tt> [static]</tt></h3>
<p>This is an overloaded function.</p>
<!-- @@@number -->
<!-- $$$number$$$numberqulonglongint -->
<h3 class="fn"><a name="number-7"></a><span class="type">QString</span> QString::<span class="name">number</span> ( <span class="type"><a href="qtglobal.html#qulonglong-typedef">qulonglong</a></span> <i>n</i>, <span class="type">int</span> <i>base</i> = 10 )<tt> [static]</tt></h3>
<p>This is an overloaded function.</p>
<!-- @@@number -->
<!-- $$$prepend[overload1]$$$prependconstQString& -->
<h3 class="fn"><a name="prepend"></a><span class="type">QString</span> &amp; QString::<span class="name">prepend</span> ( const <span class="type">QString</span> &amp; <i>str</i> )</h3>
<p>Prepends the string <i>str</i> to the beginning of this string and returns a reference to this string.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> x <span class="operator">=</span> <span class="string">&quot;ship&quot;</span>;
 <span class="type"><a href="qstring.html">QString</a></span> y <span class="operator">=</span> <span class="string">&quot;air&quot;</span>;
 x<span class="operator">.</span>prepend(y);
 <span class="comment">// x == &quot;airship&quot;</span></pre>
<p><b>See also </b><a href="qstring.html#append">append</a>() and <a href="qstring.html#insert">insert</a>().</p>
<!-- @@@prepend -->
<!-- $$$prepend$$$prependconstQLatin1String& -->
<h3 class="fn"><a name="prepend-2"></a><span class="type">QString</span> &amp; QString::<span class="name">prepend</span> ( const <span class="type"><a href="qlatin1string.html">QLatin1String</a></span> &amp; <i>str</i> )</h3>
<p>This function overloads <a href="qstring.html#prepend">prepend</a>().</p>
<p>Prepends the Latin-1 string <i>str</i> to this string.</p>
<!-- @@@prepend -->
<!-- $$$prepend$$$prependconstQByteArray& -->
<h3 class="fn"><a name="prepend-3"></a><span class="type">QString</span> &amp; QString::<span class="name">prepend</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; <i>ba</i> )</h3>
<p>This function overloads <a href="qstring.html#prepend">prepend</a>().</p>
<p>Prepends the byte array <i>ba</i> to this string. The byte array is converted to Unicode using the <a href="qstring.html#fromAscii">fromAscii</a>() function.</p>
<p>You can disable this function by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
<!-- @@@prepend -->
<!-- $$$prepend$$$prependconstchar* -->
<h3 class="fn"><a name="prepend-4"></a><span class="type">QString</span> &amp; QString::<span class="name">prepend</span> ( const <span class="type">char</span> * <i>str</i> )</h3>
<p>This function overloads <a href="qstring.html#prepend">prepend</a>().</p>
<p>Prepends the string <i>str</i> to this string. The const char pointer is converted to Unicode using the <a href="qstring.html#fromAscii">fromAscii</a>() function.</p>
<p>You can disable this function by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
<!-- @@@prepend -->
<!-- $$$prepend$$$prependQChar -->
<h3 class="fn"><a name="prepend-5"></a><span class="type">QString</span> &amp; QString::<span class="name">prepend</span> ( <span class="type"><a href="qchar.html">QChar</a></span> <i>ch</i> )</h3>
<p>This function overloads <a href="qstring.html#prepend">prepend</a>().</p>
<p>Prepends the character <i>ch</i> to this string.</p>
<!-- @@@prepend -->
<!-- $$$push_back[overload1]$$$push_backconstQString& -->
<h3 class="fn"><a name="push_back"></a><span class="type">void</span> QString::<span class="name">push_back</span> ( const <span class="type">QString</span> &amp; <i>other</i> )</h3>
<p>This function is provided for STL compatibility, appending the given <i>other</i> string onto the end of this string. It is equivalent to <tt>append(other)</tt>.</p>
<p><b>See also </b><a href="qstring.html#append">append</a>().</p>
<!-- @@@push_back -->
<!-- $$$push_back$$$push_backQChar -->
<h3 class="fn"><a name="push_back-2"></a><span class="type">void</span> QString::<span class="name">push_back</span> ( <span class="type"><a href="qchar.html">QChar</a></span> <i>ch</i> )</h3>
<p>This is an overloaded function.</p>
<p>Appends the given <i>ch</i> character onto the end of this string.</p>
<!-- @@@push_back -->
<!-- $$$push_front[overload1]$$$push_frontconstQString& -->
<h3 class="fn"><a name="push_front"></a><span class="type">void</span> QString::<span class="name">push_front</span> ( const <span class="type">QString</span> &amp; <i>other</i> )</h3>
<p>This function is provided for STL compatibility, prepending the given <i>other</i> string to the beginning of this string. It is equivalent to <tt>prepend(other)</tt>.</p>
<p><b>See also </b><a href="qstring.html#prepend">prepend</a>().</p>
<!-- @@@push_front -->
<!-- $$$push_front$$$push_frontQChar -->
<h3 class="fn"><a name="push_front-2"></a><span class="type">void</span> QString::<span class="name">push_front</span> ( <span class="type"><a href="qchar.html">QChar</a></span> <i>ch</i> )</h3>
<p>This is an overloaded function.</p>
<p>Prepends the given <i>ch</i> character to the beginning of this string.</p>
<!-- @@@push_front -->
<!-- $$$remove[overload1]$$$removeintint -->
<h3 class="fn"><a name="remove"></a><span class="type">QString</span> &amp; QString::<span class="name">remove</span> ( <span class="type">int</span> <i>position</i>, <span class="type">int</span> <i>n</i> )</h3>
<p>Removes <i>n</i> characters from the string, starting at the given <i>position</i> index, and returns a reference to the string.</p>
<p>If the specified <i>position</i> index is within the string, but <i>position</i> + <i>n</i> is beyond the end of the string, the string is truncated at the specified <i>position</i>.</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> s <span class="operator">=</span> <span class="string">&quot;Montreal&quot;</span>;
 s<span class="operator">.</span>remove(<span class="number">1</span><span class="operator">,</span> <span class="number">4</span>);
 <span class="comment">// s == &quot;Meal&quot;</span></pre>
<p><b>See also </b><a href="qstring.html#insert">insert</a>() and <a href="qstring.html#replace">replace</a>().</p>
<!-- @@@remove -->
<!-- $$$remove$$$removeQCharQt::CaseSensitivity -->
<h3 class="fn"><a name="remove-2"></a><span class="type">QString</span> &amp; QString::<span class="name">remove</span> ( <span class="type"><a href="qchar.html">QChar</a></span> <i>ch</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive )</h3>
<p>Removes every occurrence of the character <i>ch</i> in this string, and returns a reference to this string.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (default), the search is case sensitive; otherwise the search is case insensitive.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> t <span class="operator">=</span> <span class="string">&quot;Ali Baba&quot;</span>;
 t<span class="operator">.</span>remove(<span class="type"><a href="qchar.html">QChar</a></span>(<span class="char">'a'</span>)<span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>CaseInsensitive);
 <span class="comment">// t == &quot;li Bb&quot;</span></pre>
<p>This is the same as <tt>replace(ch, &quot;&quot;, cs)</tt>.</p>
<p><b>See also </b><a href="qstring.html#replace">replace</a>().</p>
<!-- @@@remove -->
<!-- $$$remove$$$removeconstQString&Qt::CaseSensitivity -->
<h3 class="fn"><a name="remove-3"></a><span class="type">QString</span> &amp; QString::<span class="name">remove</span> ( const <span class="type">QString</span> &amp; <i>str</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive )</h3>
<p>Removes every occurrence of the given <i>str</i> string in this string, and returns a reference to this string.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (default), the search is case sensitive; otherwise the search is case insensitive.</p>
<p>This is the same as <tt>replace(str, &quot;&quot;, cs)</tt>.</p>
<p><b>See also </b><a href="qstring.html#replace">replace</a>().</p>
<!-- @@@remove -->
<!-- $$$remove$$$removeconstQRegExp& -->
<h3 class="fn"><a name="remove-4"></a><span class="type">QString</span> &amp; QString::<span class="name">remove</span> ( const <span class="type"><a href="qregexp.html">QRegExp</a></span> &amp; <i>rx</i> )</h3>
<p>Removes every occurrence of the regular expression <i>rx</i> in the string, and returns a reference to the string. For example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> r <span class="operator">=</span> <span class="string">&quot;Telephone&quot;</span>;
 r<span class="operator">.</span>remove(<span class="type"><a href="qregexp.html">QRegExp</a></span>(<span class="string">&quot;[aeiou].&quot;</span>));
 <span class="comment">// r == &quot;The&quot;</span></pre>
<p><b>See also </b><a href="qstring.html#indexOf">indexOf</a>(), <a href="qstring.html#lastIndexOf">lastIndexOf</a>(), and <a href="qstring.html#replace">replace</a>().</p>
<!-- @@@remove -->
<!-- $$$repeated[overload1]$$$repeatedint -->
<h3 class="fn"><a name="repeated"></a><span class="type">QString</span> QString::<span class="name">repeated</span> ( <span class="type">int</span> <i>times</i> ) const</h3>
<p>Returns a copy of this string repeated the specified number of <i>times</i>.</p>
<p>If <i>times</i> is less than 1, an empty string is returned.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str(<span class="string">&quot;ab&quot;</span>);
 str<span class="operator">.</span>repeated(<span class="number">4</span>);            <span class="comment">// returns &quot;abababab&quot;</span></pre>
<p>This function was introduced in Qt 4.5.</p>
<!-- @@@repeated -->
<!-- $$$replace[overload1]$$$replaceintintconstQString& -->
<h3 class="fn"><a name="replace"></a><span class="type">QString</span> &amp; QString::<span class="name">replace</span> ( <span class="type">int</span> <i>position</i>, <span class="type">int</span> <i>n</i>, const <span class="type">QString</span> &amp; <i>after</i> )</h3>
<p>Replaces <i>n</i> characters beginning at index <i>position</i> with the string <i>after</i> and returns a reference to this string.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> x <span class="operator">=</span> <span class="string">&quot;Say yes!&quot;</span>;
 <span class="type"><a href="qstring.html">QString</a></span> y <span class="operator">=</span> <span class="string">&quot;no&quot;</span>;
 x<span class="operator">.</span>replace(<span class="number">4</span><span class="operator">,</span> <span class="number">3</span><span class="operator">,</span> y);
 <span class="comment">// x == &quot;Say no!&quot;</span></pre>
<p><b>See also </b><a href="qstring.html#insert">insert</a>() and <a href="qstring.html#remove">remove</a>().</p>
<!-- @@@replace -->
<!-- $$$replace$$$replaceintintconstQChar*int -->
<h3 class="fn"><a name="replace-6"></a><span class="type">QString</span> &amp; QString::<span class="name">replace</span> ( <span class="type">int</span> <i>position</i>, <span class="type">int</span> <i>n</i>, const <span class="type"><a href="qchar.html">QChar</a></span> * <i>unicode</i>, <span class="type">int</span> <i>size</i> )</h3>
<p>This function overloads <a href="qstring.html#replace">replace</a>().</p>
<p>Replaces <i>n</i> characters beginning at index <i>position</i> with the first <i>size</i> characters of the <a href="qchar.html">QChar</a> array <i>unicode</i> and returns a reference to this string.</p>
<!-- @@@replace -->
<!-- $$$replace$$$replaceintintQChar -->
<h3 class="fn"><a name="replace-7"></a><span class="type">QString</span> &amp; QString::<span class="name">replace</span> ( <span class="type">int</span> <i>position</i>, <span class="type">int</span> <i>n</i>, <span class="type"><a href="qchar.html">QChar</a></span> <i>after</i> )</h3>
<p>This function overloads <a href="qstring.html#replace">replace</a>().</p>
<p>Replaces <i>n</i> characters beginning at index <i>position</i> with the character <i>after</i> and returns a reference to this string.</p>
<!-- @@@replace -->
<!-- $$$replace$$$replaceconstQString&constQString&Qt::CaseSensitivity -->
<h3 class="fn"><a name="replace-8"></a><span class="type">QString</span> &amp; QString::<span class="name">replace</span> ( const <span class="type">QString</span> &amp; <i>before</i>, const <span class="type">QString</span> &amp; <i>after</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive )</h3>
<p>This function overloads <a href="qstring.html#replace">replace</a>().</p>
<p>Replaces every occurrence of the string <i>before</i> with the string <i>after</i> and returns a reference to this string.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (default), the search is case sensitive; otherwise the search is case insensitive.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;colour behaviour flavour neighbour&quot;</span>;
 str<span class="operator">.</span>replace(<span class="type"><a href="qstring.html">QString</a></span>(<span class="string">&quot;ou&quot;</span>)<span class="operator">,</span> <span class="type"><a href="qstring.html">QString</a></span>(<span class="string">&quot;o&quot;</span>));
 <span class="comment">// str == &quot;color behavior flavor neighbor&quot;</span></pre>
<p><b>Note:</b> The replacement text is not rescanned after it is inserted.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> equis <span class="operator">=</span> <span class="string">&quot;xxxxxx&quot;</span>;
 equis<span class="operator">.</span>replace(<span class="string">&quot;xx&quot;</span><span class="operator">,</span> <span class="string">&quot;x&quot;</span>);
 <span class="comment">// equis == &quot;xxx&quot;</span></pre>
<!-- @@@replace -->
<!-- $$$replace$$$replaceconstQChar*intconstQChar*intQt::CaseSensitivity -->
<h3 class="fn"><a name="replace-9"></a><span class="type">QString</span> &amp; QString::<span class="name">replace</span> ( const <span class="type"><a href="qchar.html">QChar</a></span> * <i>before</i>, <span class="type">int</span> <i>blen</i>, const <span class="type"><a href="qchar.html">QChar</a></span> * <i>after</i>, <span class="type">int</span> <i>alen</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive )</h3>
<p>This function overloads <a href="qstring.html#replace">replace</a>().</p>
<p>Replaces each occurrence in this string of the first <i>blen</i> characters of <i>before</i> with the first <i>alen</i> characters of <i>after</i> and returns a reference to this string.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (default), the search is case sensitive; otherwise the search is case insensitive.</p>
<p>This function was introduced in Qt 4.5.</p>
<!-- @@@replace -->
<!-- $$$replace$$$replaceQCharconstQString&Qt::CaseSensitivity -->
<h3 class="fn"><a name="replace-10"></a><span class="type">QString</span> &amp; QString::<span class="name">replace</span> ( <span class="type"><a href="qchar.html">QChar</a></span> <i>ch</i>, const <span class="type">QString</span> &amp; <i>after</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive )</h3>
<p>This function overloads <a href="qstring.html#replace">replace</a>().</p>
<p>Replaces every occurrence of the character <i>ch</i> in the string with <i>after</i> and returns a reference to this string.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (default), the search is case sensitive; otherwise the search is case insensitive.</p>
<!-- @@@replace -->
<!-- $$$replace$$$replaceQCharQCharQt::CaseSensitivity -->
<h3 class="fn"><a name="replace-11"></a><span class="type">QString</span> &amp; QString::<span class="name">replace</span> ( <span class="type"><a href="qchar.html">QChar</a></span> <i>before</i>, <span class="type"><a href="qchar.html">QChar</a></span> <i>after</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive )</h3>
<p>This function overloads <a href="qstring.html#replace">replace</a>().</p>
<p>Replaces every occurrence of the character <i>before</i> with the character <i>after</i> and returns a reference to this string.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (default), the search is case sensitive; otherwise the search is case insensitive.</p>
<!-- @@@replace -->
<!-- $$$replace$$$replaceconstQLatin1String&constQLatin1String&Qt::CaseSensitivity -->
<h3 class="fn"><a name="replace-12"></a><span class="type">QString</span> &amp; QString::<span class="name">replace</span> ( const <span class="type"><a href="qlatin1string.html">QLatin1String</a></span> &amp; <i>before</i>, const <span class="type"><a href="qlatin1string.html">QLatin1String</a></span> &amp; <i>after</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive )</h3>
<p>This function overloads <a href="qstring.html#replace">replace</a>().</p>
<p>Replaces every occurrence of the string <i>before</i> with the string <i>after</i> and returns a reference to this string.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (default), the search is case sensitive; otherwise the search is case insensitive.</p>
<p><b>Note:</b> The text is not rescanned after a replacement.</p>
<p>This function was introduced in Qt 4.5.</p>
<!-- @@@replace -->
<!-- $$$replace$$$replaceconstQLatin1String&constQString&Qt::CaseSensitivity -->
<h3 class="fn"><a name="replace-13"></a><span class="type">QString</span> &amp; QString::<span class="name">replace</span> ( const <span class="type"><a href="qlatin1string.html">QLatin1String</a></span> &amp; <i>before</i>, const <span class="type">QString</span> &amp; <i>after</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive )</h3>
<p>This function overloads <a href="qstring.html#replace">replace</a>().</p>
<p>Replaces every occurrence of the string <i>before</i> with the string <i>after</i> and returns a reference to this string.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (default), the search is case sensitive; otherwise the search is case insensitive.</p>
<p><b>Note:</b> The text is not rescanned after a replacement.</p>
<p>This function was introduced in Qt 4.5.</p>
<!-- @@@replace -->
<!-- $$$replace$$$replaceconstQString&constQLatin1String&Qt::CaseSensitivity -->
<h3 class="fn"><a name="replace-14"></a><span class="type">QString</span> &amp; QString::<span class="name">replace</span> ( const <span class="type">QString</span> &amp; <i>before</i>, const <span class="type"><a href="qlatin1string.html">QLatin1String</a></span> &amp; <i>after</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive )</h3>
<p>This function overloads <a href="qstring.html#replace">replace</a>().</p>
<p>Replaces every occurrence of the string <i>before</i> with the string <i>after</i> and returns a reference to this string.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (default), the search is case sensitive; otherwise the search is case insensitive.</p>
<p><b>Note:</b> The text is not rescanned after a replacement.</p>
<p>This function was introduced in Qt 4.5.</p>
<!-- @@@replace -->
<!-- $$$replace$$$replaceQCharconstQLatin1String&Qt::CaseSensitivity -->
<h3 class="fn"><a name="replace-15"></a><span class="type">QString</span> &amp; QString::<span class="name">replace</span> ( <span class="type"><a href="qchar.html">QChar</a></span> <i>c</i>, const <span class="type"><a href="qlatin1string.html">QLatin1String</a></span> &amp; <i>after</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive )</h3>
<p>This function overloads <a href="qstring.html#replace">replace</a>().</p>
<p>Replaces every occurrence of the character <i>c</i> with the string <i>after</i> and returns a reference to this string.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (default), the search is case sensitive; otherwise the search is case insensitive.</p>
<p><b>Note:</b> The text is not rescanned after a replacement.</p>
<p>This function was introduced in Qt 4.5.</p>
<!-- @@@replace -->
<!-- $$$replace$$$replaceconstQRegExp&constQString& -->
<h3 class="fn"><a name="replace-16"></a><span class="type">QString</span> &amp; QString::<span class="name">replace</span> ( const <span class="type"><a href="qregexp.html">QRegExp</a></span> &amp; <i>rx</i>, const <span class="type">QString</span> &amp; <i>after</i> )</h3>
<p>This function overloads <a href="qstring.html#replace">replace</a>().</p>
<p>Replaces every occurrence of the regular expression <i>rx</i> in the string with <i>after</i>. Returns a reference to the string. For example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> s <span class="operator">=</span> <span class="string">&quot;Banana&quot;</span>;
 s<span class="operator">.</span>replace(<span class="type"><a href="qregexp.html">QRegExp</a></span>(<span class="string">&quot;a[mn]&quot;</span>)<span class="operator">,</span> <span class="string">&quot;ox&quot;</span>);
 <span class="comment">// s == &quot;Boxoxa&quot;</span></pre>
<p>For regular expressions containing <a href="qregexp.html#capturing-parentheses">capturing parentheses</a>, occurrences of <b>\1</b>, <b>\2</b>, ..&#x2e;, in <i>after</i> are replaced with <i>rx</i>.cap(1), cap(2), ..&#x2e;</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> t <span class="operator">=</span> <span class="string">&quot;A &lt;i&gt;bon mot&lt;/i&gt;.&quot;</span>;
 t<span class="operator">.</span>replace(<span class="type"><a href="qregexp.html">QRegExp</a></span>(<span class="string">&quot;&lt;i&gt;([^&lt;]*)&lt;/i&gt;&quot;</span>)<span class="operator">,</span> <span class="string">&quot;\\emph{\\1}&quot;</span>);
 <span class="comment">// t == &quot;A \\emph{bon mot}.&quot;</span></pre>
<p><b>See also </b><a href="qstring.html#indexOf">indexOf</a>(), <a href="qstring.html#lastIndexOf">lastIndexOf</a>(), <a href="qstring.html#remove">remove</a>(), and <a href="qregexp.html#cap">QRegExp::cap</a>().</p>
<!-- @@@replace -->
<!-- $$$reserve[overload1]$$$reserveint -->
<h3 class="fn"><a name="reserve"></a><span class="type">void</span> QString::<span class="name">reserve</span> ( <span class="type">int</span> <i>size</i> )</h3>
<p>Attempts to allocate memory for at least <i>size</i> characters. If you know in advance how large the string will be, you can call this function, and if you resize the string often you are likely to get better performance. If <i>size</i> is an underestimate, the worst that will happen is that the <a href="qstring.html">QString</a> will be a bit slower.</p>
<p>The sole purpose of this function is to provide a means of fine tuning <a href="qstring.html">QString</a>'s memory usage. In general, you will rarely ever need to call this function. If you want to change the size of the string, call <a href="qstring.html#resize">resize</a>().</p>
<p>This function is useful for code that needs to build up a long string and wants to avoid repeated reallocation. In this example, we want to add to the string until some condition is true, and we're fairly sure that size is large enough to make a call to reserve() worthwhile:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> result;
 <span class="type">int</span> maxSize;
 <span class="type">bool</span> condition;
 <span class="type"><a href="qchar.html">QChar</a></span> nextChar;

 result<span class="operator">.</span>reserve(maxSize);

 <span class="keyword">while</span> (condition)
     result<span class="operator">.</span>append(nextChar);

 result<span class="operator">.</span>squeeze();</pre>
<p><b>See also </b><a href="qstring.html#squeeze">squeeze</a>() and <a href="qstring.html#capacity">capacity</a>().</p>
<!-- @@@reserve -->
<!-- $$$resize[overload1]$$$resizeint -->
<h3 class="fn"><a name="resize"></a><span class="type">void</span> QString::<span class="name">resize</span> ( <span class="type">int</span> <i>size</i> )</h3>
<p>Sets the size of the string to <i>size</i> characters.</p>
<p>If <i>size</i> is greater than the current size, the string is extended to make it <i>size</i> characters long with the extra characters added to the end. The new characters are uninitialized.</p>
<p>If <i>size</i> is less than the current size, characters are removed from the end.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> s <span class="operator">=</span> <span class="string">&quot;Hello world&quot;</span>;
 s<span class="operator">.</span>resize(<span class="number">5</span>);
 <span class="comment">// s == &quot;Hello&quot;</span>

 s<span class="operator">.</span>resize(<span class="number">8</span>);
 <span class="comment">// s == &quot;Hello???&quot; (where ? stands for any character)</span></pre>
<p>If you want to append a certain number of identical characters to the string, use <a href="qstring.html#operator-2b-eq">operator+=</a>() as follows rather than resize():</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> t <span class="operator">=</span> <span class="string">&quot;Hello&quot;</span>;
 t <span class="operator">+</span><span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span>(<span class="number">10</span><span class="operator">,</span> <span class="char">'X'</span>);
 <span class="comment">// t == &quot;HelloXXXXXXXXXX&quot;</span></pre>
<p>If you want to expand the string so that it reaches a certain width and fill the new positions with a particular character, use the <a href="qstring.html#leftJustified">leftJustified</a>() function:</p>
<p>If <i>size</i> is negative, it is equivalent to passing zero.</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> r <span class="operator">=</span> <span class="string">&quot;Hello&quot;</span>;
 r <span class="operator">=</span> r<span class="operator">.</span>leftJustified(<span class="number">10</span><span class="operator">,</span> <span class="char">' '</span>);
 <span class="comment">// r == &quot;Hello     &quot;</span></pre>
<p><b>See also </b><a href="qstring.html#truncate">truncate</a>() and <a href="qstring.html#reserve">reserve</a>().</p>
<!-- @@@resize -->
<!-- $$$right[overload1]$$$rightint -->
<h3 class="fn"><a name="right"></a><span class="type">QString</span> QString::<span class="name">right</span> ( <span class="type">int</span> <i>n</i> ) const</h3>
<p>Returns a substring that contains the <i>n</i> rightmost characters of the string.</p>
<p>The entire string is returned if <i>n</i> is greater than <a href="qstring.html#size">size</a>() or less than zero.</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> x <span class="operator">=</span> <span class="string">&quot;Pineapple&quot;</span>;
 <span class="type"><a href="qstring.html">QString</a></span> y <span class="operator">=</span> x<span class="operator">.</span>right(<span class="number">5</span>);      <span class="comment">// y == &quot;apple&quot;</span></pre>
<p><b>See also </b><a href="qstring.html#left">left</a>(), <a href="qstring.html#mid">mid</a>(), and <a href="qstring.html#endsWith">endsWith</a>().</p>
<!-- @@@right -->
<!-- $$$rightJustified[overload1]$$$rightJustifiedintQCharbool -->
<h3 class="fn"><a name="rightJustified"></a><span class="type">QString</span> QString::<span class="name">rightJustified</span> ( <span class="type">int</span> <i>width</i>, <span class="type"><a href="qchar.html">QChar</a></span> <i>fill</i> = QLatin1Char( ' ' ), <span class="type">bool</span> <i>truncate</i> = false ) const</h3>
<p>Returns a string of <a href="qstring.html#size">size</a>() <i>width</i> that contains the <i>fill</i> character followed by the string. For example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> s <span class="operator">=</span> <span class="string">&quot;apple&quot;</span>;
 <span class="type"><a href="qstring.html">QString</a></span> t <span class="operator">=</span> s<span class="operator">.</span>rightJustified(<span class="number">8</span><span class="operator">,</span> <span class="char">'.'</span>);    <span class="comment">// t == &quot;...apple&quot;</span></pre>
<p>If <i>truncate</i> is false and the <a href="qstring.html#size">size</a>() of the string is more than <i>width</i>, then the returned string is a copy of the string.</p>
<p>If <i>truncate</i> is true and the <a href="qstring.html#size">size</a>() of the string is more than <i>width</i>, then the resulting string is truncated at position <i>width</i>.</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;Pineapple&quot;</span>;
 str <span class="operator">=</span> str<span class="operator">.</span>rightJustified(<span class="number">5</span><span class="operator">,</span> <span class="char">'.'</span><span class="operator">,</span> <span class="keyword">true</span>);    <span class="comment">// str == &quot;Pinea&quot;</span></pre>
<p><b>See also </b><a href="qstring.html#leftJustified">leftJustified</a>().</p>
<!-- @@@rightJustified -->
<!-- $$$rightRef[overload1]$$$rightRefint -->
<h3 class="fn"><a name="rightRef"></a><span class="type"><a href="qstringref.html">QStringRef</a></span> QString::<span class="name">rightRef</span> ( <span class="type">int</span> <i>n</i> ) const</h3>
<p>Returns a substring reference to the <i>n</i> rightmost characters of the string.</p>
<p>If <i>n</i> is greater than <a href="qstring.html#size">size</a>() or less than zero, a reference to the entire string is returned.</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> x <span class="operator">=</span> <span class="string">&quot;Pineapple&quot;</span>;
 <span class="type"><a href="qstringref.html">QStringRef</a></span> y <span class="operator">=</span> x<span class="operator">.</span>rightRef(<span class="number">5</span>);       <span class="comment">// y == &quot;apple&quot;</span></pre>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also </b><a href="qstring.html#right">right</a>(), <a href="qstring.html#leftRef">leftRef</a>(), <a href="qstring.html#midRef">midRef</a>(), and <a href="qstring.html#endsWith">endsWith</a>().</p>
<!-- @@@rightRef -->
<!-- $$$section[overload1]$$$sectionQCharintintSectionFlags -->
<h3 class="fn"><a name="section"></a><span class="type">QString</span> QString::<span class="name">section</span> ( <span class="type"><a href="qchar.html">QChar</a></span> <i>sep</i>, <span class="type">int</span> <i>start</i>, <span class="type">int</span> <i>end</i> = -1, <span class="type"><a href="qstring.html#SectionFlag-enum">SectionFlags</a></span> <i>flags</i> = SectionDefault ) const</h3>
<p>This function returns a section of the string.</p>
<p>This string is treated as a sequence of fields separated by the character, <i>sep</i>. The returned string consists of the fields from position <i>start</i> to position <i>end</i> inclusive. If <i>end</i> is not specified, all fields from position <i>start</i> to the end of the string are included. Fields are numbered 0, 1, 2, etc., counting from the left, and -1, -2, etc., counting from right to left.</p>
<p>The <i>flags</i> argument can be used to affect some aspects of the function's behavior, e.g&#x2e; whether to be case sensitive, whether to skip empty fields and how to deal with leading and trailing separators; see <a href="qstring.html#SectionFlag-enum">SectionFlags</a>.</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str;
 <span class="type"><a href="qstring.html">QString</a></span> csv <span class="operator">=</span> <span class="string">&quot;forename,middlename,surname,phone&quot;</span>;
 <span class="type"><a href="qstring.html">QString</a></span> path <span class="operator">=</span> <span class="string">&quot;/usr/local/bin/myapp&quot;</span>; <span class="comment">// First field is empty</span>
 <span class="type"><a href="qstring.html">QString</a></span><span class="operator">::</span>SectionFlag flag <span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span><span class="operator">::</span>SectionSkipEmpty;

 str <span class="operator">=</span> csv<span class="operator">.</span>section(<span class="char">','</span><span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="number">2</span>);   <span class="comment">// str == &quot;surname&quot;</span>
 str <span class="operator">=</span> path<span class="operator">.</span>section(<span class="char">'/'</span><span class="operator">,</span> <span class="number">3</span><span class="operator">,</span> <span class="number">4</span>);  <span class="comment">// str == &quot;bin/myapp&quot;</span>
 str <span class="operator">=</span> path<span class="operator">.</span>section(<span class="char">'/'</span><span class="operator">,</span> <span class="number">3</span><span class="operator">,</span> <span class="number">3</span><span class="operator">,</span> flag); <span class="comment">// str == &quot;myapp&quot;</span></pre>
<p>If <i>start</i> or <i>end</i> is negative, we count fields from the right of the string, the right-most field being -1, the one from right-most field being -2, and so on.</p>
<pre class="cpp"> str <span class="operator">=</span> csv<span class="operator">.</span>section(<span class="char">','</span><span class="operator">,</span> <span class="operator">-</span><span class="number">3</span><span class="operator">,</span> <span class="operator">-</span><span class="number">2</span>);  <span class="comment">// str == &quot;middlename,surname&quot;</span>
 str <span class="operator">=</span> path<span class="operator">.</span>section(<span class="char">'/'</span><span class="operator">,</span> <span class="operator">-</span><span class="number">1</span>); <span class="comment">// str == &quot;myapp&quot;</span></pre>
<p><b>See also </b><a href="qstring.html#split">split</a>().</p>
<!-- @@@section -->
<!-- $$$section$$$sectionconstQString&intintSectionFlags -->
<h3 class="fn"><a name="section-2"></a><span class="type">QString</span> QString::<span class="name">section</span> ( const <span class="type">QString</span> &amp; <i>sep</i>, <span class="type">int</span> <i>start</i>, <span class="type">int</span> <i>end</i> = -1, <span class="type"><a href="qstring.html#SectionFlag-enum">SectionFlags</a></span> <i>flags</i> = SectionDefault ) const</h3>
<p>This function overloads <a href="qstring.html#section">section</a>().</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str;
 <span class="type"><a href="qstring.html">QString</a></span> data <span class="operator">=</span> <span class="string">&quot;forename**middlename**surname**phone&quot;</span>;

 str <span class="operator">=</span> data<span class="operator">.</span>section(<span class="string">&quot;**&quot;</span><span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="number">2</span>); <span class="comment">// str == &quot;surname&quot;</span>
 str <span class="operator">=</span> data<span class="operator">.</span>section(<span class="string">&quot;**&quot;</span><span class="operator">,</span> <span class="operator">-</span><span class="number">3</span><span class="operator">,</span> <span class="operator">-</span><span class="number">2</span>); <span class="comment">// str == &quot;middlename**surname&quot;</span></pre>
<p><b>See also </b><a href="qstring.html#split">split</a>().</p>
<!-- @@@section -->
<!-- $$$section$$$sectionconstQRegExp&intintSectionFlags -->
<h3 class="fn"><a name="section-3"></a><span class="type">QString</span> QString::<span class="name">section</span> ( const <span class="type"><a href="qregexp.html">QRegExp</a></span> &amp; <i>reg</i>, <span class="type">int</span> <i>start</i>, <span class="type">int</span> <i>end</i> = -1, <span class="type"><a href="qstring.html#SectionFlag-enum">SectionFlags</a></span> <i>flags</i> = SectionDefault ) const</h3>
<p>This function overloads <a href="qstring.html#section">section</a>().</p>
<p>This string is treated as a sequence of fields separated by the regular expression, <i>reg</i>.</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> line <span class="operator">=</span> <span class="string">&quot;forename\tmiddlename  surname \t \t phone&quot;</span>;
 <span class="type"><a href="qregexp.html">QRegExp</a></span> sep(<span class="string">&quot;\\s+&quot;</span>);
 str <span class="operator">=</span> line<span class="operator">.</span>section(sep<span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="number">2</span>); <span class="comment">// s == &quot;surname&quot;</span>
 str <span class="operator">=</span> line<span class="operator">.</span>section(sep<span class="operator">,</span> <span class="operator">-</span><span class="number">3</span><span class="operator">,</span> <span class="operator">-</span><span class="number">2</span>); <span class="comment">// s == &quot;middlename  surname&quot;</span></pre>
<p><b>Warning:</b> Using this <a href="qregexp.html">QRegExp</a> version is much more expensive than the overloaded string and character versions.</p>
<p><b>See also </b><a href="qstring.html#split">split</a>() and <a href="qstring.html#simplified">simplified</a>().</p>
<!-- @@@section -->
<!-- $$$setNum[overload1]$$$setNumintint -->
<h3 class="fn"><a name="setNum"></a><span class="type">QString</span> &amp; QString::<span class="name">setNum</span> ( <span class="type">int</span> <i>n</i>, <span class="type">int</span> <i>base</i> = 10 )</h3>
<p>Sets the string to the printed value of <i>n</i> in the specified <i>base</i>, and returns a reference to the string.</p>
<p>The base is 10 by default and must be between 2 and 36. For bases other than 10, <i>n</i> is treated as an unsigned integer.</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str;
 str<span class="operator">.</span>setNum(<span class="number">1234</span>);       <span class="comment">// str == &quot;1234&quot;</span></pre>
<p>The formatting always uses <a href="qlocale.html#Language-enum">QLocale::C</a>, i.e&#x2e;, English/UnitedStates. To get a localized string representation of a number, use <a href="qlocale.html#toString">QLocale::toString</a>() with the appropriate locale.</p>
<!-- @@@setNum -->
<!-- $$$setNum$$$setNumuintint -->
<h3 class="fn"><a name="setNum-2"></a><span class="type">QString</span> &amp; QString::<span class="name">setNum</span> ( <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> <i>n</i>, <span class="type">int</span> <i>base</i> = 10 )</h3>
<p>This is an overloaded function.</p>
<!-- @@@setNum -->
<!-- $$$setNum$$$setNumlongint -->
<h3 class="fn"><a name="setNum-3"></a><span class="type">QString</span> &amp; QString::<span class="name">setNum</span> ( <span class="type">long</span> <i>n</i>, <span class="type">int</span> <i>base</i> = 10 )</h3>
<p>This is an overloaded function.</p>
<!-- @@@setNum -->
<!-- $$$setNum$$$setNumulongint -->
<h3 class="fn"><a name="setNum-4"></a><span class="type">QString</span> &amp; QString::<span class="name">setNum</span> ( <span class="type"><a href="qtglobal.html#ulong-typedef">ulong</a></span> <i>n</i>, <span class="type">int</span> <i>base</i> = 10 )</h3>
<p>This is an overloaded function.</p>
<!-- @@@setNum -->
<!-- $$$setNum$$$setNumqlonglongint -->
<h3 class="fn"><a name="setNum-5"></a><span class="type">QString</span> &amp; QString::<span class="name">setNum</span> ( <span class="type"><a href="qtglobal.html#qlonglong-typedef">qlonglong</a></span> <i>n</i>, <span class="type">int</span> <i>base</i> = 10 )</h3>
<p>This is an overloaded function.</p>
<!-- @@@setNum -->
<!-- $$$setNum$$$setNumqulonglongint -->
<h3 class="fn"><a name="setNum-6"></a><span class="type">QString</span> &amp; QString::<span class="name">setNum</span> ( <span class="type"><a href="qtglobal.html#qulonglong-typedef">qulonglong</a></span> <i>n</i>, <span class="type">int</span> <i>base</i> = 10 )</h3>
<p>This is an overloaded function.</p>
<!-- @@@setNum -->
<!-- $$$setNum$$$setNumshortint -->
<h3 class="fn"><a name="setNum-7"></a><span class="type">QString</span> &amp; QString::<span class="name">setNum</span> ( <span class="type">short</span> <i>n</i>, <span class="type">int</span> <i>base</i> = 10 )</h3>
<p>This is an overloaded function.</p>
<!-- @@@setNum -->
<!-- $$$setNum$$$setNumushortint -->
<h3 class="fn"><a name="setNum-8"></a><span class="type">QString</span> &amp; QString::<span class="name">setNum</span> ( <span class="type"><a href="qtglobal.html#ushort-typedef">ushort</a></span> <i>n</i>, <span class="type">int</span> <i>base</i> = 10 )</h3>
<p>This is an overloaded function.</p>
<!-- @@@setNum -->
<!-- $$$setNum$$$setNumdoublecharint -->
<h3 class="fn"><a name="setNum-9"></a><span class="type">QString</span> &amp; QString::<span class="name">setNum</span> ( <span class="type">double</span> <i>n</i>, <span class="type">char</span> <i>format</i> = 'g', <span class="type">int</span> <i>precision</i> = 6 )</h3>
<p>This is an overloaded function.</p>
<p>Sets the string to the printed value of <i>n</i>, formatted according to the given <i>format</i> and <i>precision</i>, and returns a reference to the string.</p>
<p>The <i>format</i> can be 'f', 'F', 'e', 'E', 'g' or 'G' (see the <a href="qstring.html#arg">arg</a>() function documentation for an explanation of the formats).</p>
<p>Unlike <a href="qlocale.html#toString">QLocale::toString</a>(), this function doesn't honor the user's locale settings.</p>
<!-- @@@setNum -->
<!-- $$$setNum$$$setNumfloatcharint -->
<h3 class="fn"><a name="setNum-10"></a><span class="type">QString</span> &amp; QString::<span class="name">setNum</span> ( <span class="type">float</span> <i>n</i>, <span class="type">char</span> <i>format</i> = 'g', <span class="type">int</span> <i>precision</i> = 6 )</h3>
<p>This is an overloaded function.</p>
<p>Sets the string to the printed value of <i>n</i>, formatted according to the given <i>format</i> and <i>precision</i>, and returns a reference to the string.</p>
<!-- @@@setNum -->
<!-- $$$setRawData[overload1]$$$setRawDataconstQChar*int -->
<h3 class="fn"><a name="setRawData"></a><span class="type">QString</span> &amp; QString::<span class="name">setRawData</span> ( const <span class="type"><a href="qchar.html">QChar</a></span> * <i>unicode</i>, <span class="type">int</span> <i>size</i> )</h3>
<p>Resets the <a href="qstring.html">QString</a> to use the first <i>size</i> Unicode characters in the array <i>unicode</i>. The data in <i>unicode</i> is <i>not</i> copied. The caller must be able to guarantee that <i>unicode</i> will not be deleted or modified as long as the <a href="qstring.html">QString</a> (or an unmodified copy of it) exists.</p>
<p>This function can be used instead of <a href="qstring.html#fromRawData">fromRawData</a>() to re-use existings <a href="qstring.html">QString</a> objects to save memory re-allocations.</p>
<p>This function was introduced in Qt 4.7.</p>
<p><b>See also </b><a href="qstring.html#fromRawData">fromRawData</a>().</p>
<!-- @@@setRawData -->
<!-- $$$setUnicode[overload1]$$$setUnicodeconstQChar*int -->
<h3 class="fn"><a name="setUnicode"></a><span class="type">QString</span> &amp; QString::<span class="name">setUnicode</span> ( const <span class="type"><a href="qchar.html">QChar</a></span> * <i>unicode</i>, <span class="type">int</span> <i>size</i> )</h3>
<p>Resizes the string to <i>size</i> characters and copies <i>unicode</i> into the string.</p>
<p>If <i>unicode</i> is 0, nothing is copied, but the string is still resized to <i>size</i>.</p>
<p><b>See also </b><a href="qstring.html#unicode">unicode</a>() and <a href="qstring.html#setUtf16">setUtf16</a>().</p>
<!-- @@@setUnicode -->
<!-- $$$setUtf16[overload1]$$$setUtf16constushort*int -->
<h3 class="fn"><a name="setUtf16"></a><span class="type">QString</span> &amp; QString::<span class="name">setUtf16</span> ( const <span class="type"><a href="qtglobal.html#ushort-typedef">ushort</a></span> * <i>unicode</i>, <span class="type">int</span> <i>size</i> )</h3>
<p>Resizes the string to <i>size</i> characters and copies <i>unicode</i> into the string.</p>
<p>If <i>unicode</i> is 0, nothing is copied, but the string is still resized to <i>size</i>.</p>
<p>Note that unlike <a href="qstring.html#fromUtf16">fromUtf16</a>(), this function does not consider BOMs and possibly differing byte ordering.</p>
<p><b>See also </b><a href="qstring.html#utf16">utf16</a>() and <a href="qstring.html#setUnicode">setUnicode</a>().</p>
<!-- @@@setUtf16 -->
<!-- $$$simplified[overload1]$$$simplified -->
<h3 class="fn"><a name="simplified"></a><span class="type">QString</span> QString::<span class="name">simplified</span> () const</h3>
<p>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.</p>
<p>Whitespace means any character for which <a href="qchar.html#isSpace">QChar::isSpace</a>() returns true. This includes the ASCII characters '\t', '\n', '\v', '\f', '\r', and ' '.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;  lots\t of\nwhitespace\r\n &quot;</span>;
 str <span class="operator">=</span> str<span class="operator">.</span>simplified();
 <span class="comment">// str == &quot;lots of whitespace&quot;;</span></pre>
<p><b>See also </b><a href="qstring.html#trimmed">trimmed</a>().</p>
<!-- @@@simplified -->
<!-- $$$size[overload1]$$$size -->
<h3 class="fn"><a name="size"></a><span class="type">int</span> QString::<span class="name">size</span> () const</h3>
<p>Returns the number of characters in this string.</p>
<p>The last character in the string is at position size() - 1. In addition, <a href="qstring.html">QString</a> ensures that the character at position size() is always '\0', so that you can use the return value of <a href="qstring.html#data">data</a>() and <a href="qstring.html#constData">constData</a>() as arguments to functions that expect '\0'-terminated strings.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;World&quot;</span>;
 <span class="type">int</span> n <span class="operator">=</span> str<span class="operator">.</span>size();         <span class="comment">// n == 5</span>
 str<span class="operator">.</span>data()<span class="operator">[</span><span class="number">0</span><span class="operator">]</span>;              <span class="comment">// returns 'W'</span>
 str<span class="operator">.</span>data()<span class="operator">[</span><span class="number">4</span><span class="operator">]</span>;              <span class="comment">// returns 'd'</span>
 str<span class="operator">.</span>data()<span class="operator">[</span><span class="number">5</span><span class="operator">]</span>;              <span class="comment">// returns '\0'</span></pre>
<p><b>See also </b><a href="qstring.html#isEmpty">isEmpty</a>() and <a href="qstring.html#resize">resize</a>().</p>
<!-- @@@size -->
<!-- $$$split[overload1]$$$splitconstQString&SplitBehaviorQt::CaseSensitivity -->
<h3 class="fn"><a name="split"></a><span class="type"><a href="qstringlist.html">QStringList</a></span> QString::<span class="name">split</span> ( const <span class="type">QString</span> &amp; <i>sep</i>, <span class="type"><a href="qstring.html#SplitBehavior-enum">SplitBehavior</a></span> <i>behavior</i> = KeepEmptyParts, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>Splits the string into substrings wherever <i>sep</i> occurs, and returns the list of those strings. If <i>sep</i> does not match anywhere in the string, split() returns a single-element list containing this string.</p>
<p><i>cs</i> specifies whether <i>sep</i> should be matched case sensitively or case insensitively.</p>
<p>If <i>behavior</i> is <a href="qstring.html#SplitBehavior-enum">QString::SkipEmptyParts</a>, empty entries don't appear in the result. By default, empty entries are kept.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;a,,b,c&quot;</span>;

 <span class="type"><a href="qstringlist.html">QStringList</a></span> list1 <span class="operator">=</span> str<span class="operator">.</span>split(<span class="string">&quot;,&quot;</span>);
 <span class="comment">// list1: [ &quot;a&quot;, &quot;&quot;, &quot;b&quot;, &quot;c&quot; ]</span>

 <span class="type"><a href="qstringlist.html">QStringList</a></span> list2 <span class="operator">=</span> str<span class="operator">.</span>split(<span class="string">&quot;,&quot;</span><span class="operator">,</span> <span class="type"><a href="qstring.html">QString</a></span><span class="operator">::</span>SkipEmptyParts);
 <span class="comment">// list2: [ &quot;a&quot;, &quot;b&quot;, &quot;c&quot; ]</span></pre>
<p><b>See also </b><a href="qstringlist.html#join">QStringList::join</a>() and <a href="qstring.html#section">section</a>().</p>
<!-- @@@split -->
<!-- $$$split$$$splitconstQChar&SplitBehaviorQt::CaseSensitivity -->
<h3 class="fn"><a name="split-2"></a><span class="type"><a href="qstringlist.html">QStringList</a></span> QString::<span class="name">split</span> ( const <span class="type"><a href="qchar.html">QChar</a></span> &amp; <i>sep</i>, <span class="type"><a href="qstring.html#SplitBehavior-enum">SplitBehavior</a></span> <i>behavior</i> = KeepEmptyParts, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>This is an overloaded function.</p>
<!-- @@@split -->
<!-- $$$split$$$splitconstQRegExp&SplitBehavior -->
<h3 class="fn"><a name="split-3"></a><span class="type"><a href="qstringlist.html">QStringList</a></span> QString::<span class="name">split</span> ( const <span class="type"><a href="qregexp.html">QRegExp</a></span> &amp; <i>rx</i>, <span class="type"><a href="qstring.html#SplitBehavior-enum">SplitBehavior</a></span> <i>behavior</i> = KeepEmptyParts ) const</h3>
<p>This is an overloaded function.</p>
<p>Splits the string into substrings wherever the regular expression <i>rx</i> matches, and returns the list of those strings. If <i>rx</i> does not match anywhere in the string, <a href="qstring.html#split">split</a>() returns a single-element list containing this string.</p>
<p>Here's an example where we extract the words in a sentence using one or more whitespace characters as the separator:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str;
 <span class="type"><a href="qstringlist.html">QStringList</a></span> list;

 str <span class="operator">=</span> <span class="string">&quot;Some  text\n\twith  strange whitespace.&quot;</span>;
 list <span class="operator">=</span> str<span class="operator">.</span>split(<span class="type"><a href="qregexp.html">QRegExp</a></span>(<span class="string">&quot;\\s+&quot;</span>));
 <span class="comment">// list: [ &quot;Some&quot;, &quot;text&quot;, &quot;with&quot;, &quot;strange&quot;, &quot;whitespace.&quot; ]</span></pre>
<p>Here's a similar example, but this time we use any sequence of non-word characters as the separator:</p>
<pre class="cpp"> str <span class="operator">=</span> <span class="string">&quot;This time, a normal English sentence.&quot;</span>;
 list <span class="operator">=</span> str<span class="operator">.</span>split(<span class="type"><a href="qregexp.html">QRegExp</a></span>(<span class="string">&quot;\\W+&quot;</span>)<span class="operator">,</span> <span class="type"><a href="qstring.html">QString</a></span><span class="operator">::</span>SkipEmptyParts);
 <span class="comment">// list: [ &quot;This&quot;, &quot;time&quot;, &quot;a&quot;, &quot;normal&quot;, &quot;English&quot;, &quot;sentence&quot; ]</span></pre>
<p>Here's a third example where we use a zero-length assertion, <b>\b</b> (word boundary), to split the string into an alternating sequence of non-word and word tokens:</p>
<pre class="cpp"> str <span class="operator">=</span> <span class="string">&quot;Now: this sentence fragment.&quot;</span>;
 list <span class="operator">=</span> str<span class="operator">.</span>split(<span class="type"><a href="qregexp.html">QRegExp</a></span>(<span class="string">&quot;\\b&quot;</span>));
 <span class="comment">// list: [ &quot;&quot;, &quot;Now&quot;, &quot;: &quot;, &quot;this&quot;, &quot; &quot;, &quot;sentence&quot;, &quot; &quot;, &quot;fragment&quot;, &quot;.&quot; ]</span></pre>
<p><b>See also </b><a href="qstringlist.html#join">QStringList::join</a>() and <a href="qstring.html#section">section</a>().</p>
<!-- @@@split -->
<!-- $$$sprintf[overload1]$$$sprintfconstchar*... -->
<h3 class="fn"><a name="sprintf"></a><span class="type">QString</span> &amp; QString::<span class="name">sprintf</span> ( const <span class="type">char</span> * <i>cformat</i>, ... )</h3>
<p>Safely builds a formatted string from the format string <i>cformat</i> and an arbitrary list of arguments.</p>
<p>The %lc escape sequence expects a unicode character of type ushort (as returned by <a href="qchar.html#unicode">QChar::unicode</a>()). The %ls escape sequence expects a pointer to a zero-terminated array of unicode characters of type ushort (as returned by <a href="qstring.html#utf16">QString::utf16</a>()).</p>
<p><b>Note:</b> This function expects a UTF-8 string for %s and Latin-1 for the format string.</p>
<p>The format string supports most of the conversion specifiers provided by printf() in the standard C++ library. It doesn't honor the length modifiers (e.g&#x2e; <tt>h</tt> for <tt>short</tt>, <tt>ll</tt> for <tt>long long</tt>). If you need those, use the standard snprintf() function instead:</p>
<pre class="cpp"> size_t BufSize;
 <span class="type">char</span> buf<span class="operator">[</span>BufSize<span class="operator">]</span>;

 <span class="operator">::</span>snprintf(buf<span class="operator">,</span> BufSize<span class="operator">,</span> <span class="string">&quot;%lld&quot;</span><span class="operator">,</span> <span class="number">123456789LL</span>);
 <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span><span class="operator">::</span>fromAscii(buf);</pre>
<p><b>Warning:</b> We do not recommend using QString::sprintf() in new Qt code. Instead, consider using <a href="qtextstream.html">QTextStream</a> or <a href="qstring.html#arg">arg</a>(), both of which support Unicode strings seamlessly and are type-safe. Here's an example that uses <a href="qtextstream.html">QTextStream</a>:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> result;
 <span class="type"><a href="qtextstream.html">QTextStream</a></span>(<span class="operator">&amp;</span>result) <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;pi = &quot;</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="number">3.14</span>;
 <span class="comment">// result == &quot;pi = 3.14&quot;</span></pre>
<p>For <a href="qobject.html#tr">translations</a>, especially if the strings contains more than one escape sequence, you should consider using the <a href="qstring.html#arg">arg</a>() function instead. This allows the order of the replacements to be controlled by the translator.</p>
<p><b>See also </b><a href="qstring.html#arg">arg</a>().</p>
<!-- @@@sprintf -->
<!-- $$$squeeze[overload1]$$$squeeze -->
<h3 class="fn"><a name="squeeze"></a><span class="type">void</span> QString::<span class="name">squeeze</span> ()</h3>
<p>Releases any memory not required to store the character data.</p>
<p>The sole purpose of this function is to provide a means of fine tuning <a href="qstring.html">QString</a>'s memory usage. In general, you will rarely ever need to call this function.</p>
<p><b>See also </b><a href="qstring.html#reserve">reserve</a>() and <a href="qstring.html#capacity">capacity</a>().</p>
<!-- @@@squeeze -->
<!-- $$$startsWith[overload1]$$$startsWithconstQString&Qt::CaseSensitivity -->
<h3 class="fn"><a name="startsWith"></a><span class="type">bool</span> QString::<span class="name">startsWith</span> ( const <span class="type">QString</span> &amp; <i>s</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>Returns true if the string starts with <i>s</i>; otherwise returns false.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (default), the search is case sensitive; otherwise the search is case insensitive.</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;Bananas&quot;</span>;
 str<span class="operator">.</span>startsWith(<span class="string">&quot;Ban&quot;</span>);     <span class="comment">// returns true</span>
 str<span class="operator">.</span>startsWith(<span class="string">&quot;Car&quot;</span>);     <span class="comment">// returns false</span></pre>
<p><b>See also </b><a href="qstring.html#endsWith">endsWith</a>().</p>
<!-- @@@startsWith -->
<!-- $$$startsWith$$$startsWithconstQLatin1String&Qt::CaseSensitivity -->
<h3 class="fn"><a name="startsWith-3"></a><span class="type">bool</span> QString::<span class="name">startsWith</span> ( const <span class="type"><a href="qlatin1string.html">QLatin1String</a></span> &amp; <i>s</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>This function overloads <a href="qstring.html#startsWith">startsWith</a>().</p>
<!-- @@@startsWith -->
<!-- $$$startsWith$$$startsWithconstQChar&Qt::CaseSensitivity -->
<h3 class="fn"><a name="startsWith-4"></a><span class="type">bool</span> QString::<span class="name">startsWith</span> ( const <span class="type"><a href="qchar.html">QChar</a></span> &amp; <i>c</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>This function overloads <a href="qstring.html#startsWith">startsWith</a>().</p>
<p>Returns true if the string starts with <i>c</i>; otherwise returns false.</p>
<!-- @@@startsWith -->
<!-- $$$startsWith$$$startsWithconstQStringRef&Qt::CaseSensitivity -->
<h3 class="fn"><a name="startsWith-5"></a><span class="type">bool</span> QString::<span class="name">startsWith</span> ( const <span class="type"><a href="qstringref.html">QStringRef</a></span> &amp; <i>s</i>, <span class="type"><a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a></span> <i>cs</i> = Qt::CaseSensitive ) const</h3>
<p>This is an overloaded function.</p>
<p>Returns true if the string starts with the string reference <i>s</i>; otherwise returns false.</p>
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a> (default), the search is case sensitive; otherwise the search is case insensitive.</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also </b><a href="qstring.html#endsWith">endsWith</a>().</p>
<!-- @@@startsWith -->
<!-- $$$swap[overload1]$$$swapQString& -->
<h3 class="fn"><a name="swap"></a><span class="type">void</span> QString::<span class="name">swap</span> ( <span class="type">QString</span> &amp; <i>other</i> )</h3>
<p>Swaps string <i>other</i> with this string. This operation is very fast and never fails.</p>
<p>This function was introduced in Qt 4.8.</p>
<!-- @@@swap -->
<!-- $$$toAscii[overload1]$$$toAscii -->
<h3 class="fn"><a name="toAscii"></a><span class="type"><a href="qbytearray.html">QByteArray</a></span> QString::<span class="name">toAscii</span> () const</h3>
<p>Returns an 8-bit representation of the string as a <a href="qbytearray.html">QByteArray</a>.</p>
<p>If a codec has been set using <a href="qtextcodec.html#setCodecForCStrings">QTextCodec::setCodecForCStrings</a>(), it is used to convert Unicode to 8-bit char; otherwise this function does the same as <a href="qstring.html#toLatin1">toLatin1</a>().</p>
<p>Note that, despite the name, this function does not necessarily return an US-ASCII (ANSI X3.4-1986) string and its result may not be US-ASCII compatible.</p>
<p><b>See also </b><a href="qstring.html#fromAscii">fromAscii</a>(), <a href="qstring.html#toLatin1">toLatin1</a>(), <a href="qstring.html#toUtf8">toUtf8</a>(), <a href="qstring.html#toLocal8Bit">toLocal8Bit</a>(), and <a href="qtextcodec.html">QTextCodec</a>.</p>
<!-- @@@toAscii -->
<!-- $$$toCaseFolded[overload1]$$$toCaseFolded -->
<h3 class="fn"><a name="toCaseFolded"></a><span class="type">QString</span> QString::<span class="name">toCaseFolded</span> () const</h3>
<p>Returns the case folded equivalent of the string. For most Unicode characters this is the same as <a href="qstring.html#toLower">toLower</a>().</p>
<!-- @@@toCaseFolded -->
<!-- $$$toDouble[overload1]$$$toDoublebool* -->
<h3 class="fn"><a name="toDouble"></a><span class="type">double</span> QString::<span class="name">toDouble</span> ( <span class="type">bool</span> * <i>ok</i> = 0 ) const</h3>
<p>Returns the string converted to a <tt>double</tt> value.</p>
<p>Returns 0.0 if the conversion fails.</p>
<p>If a conversion error occurs, <tt>*</tt><i>ok</i> is set to false; otherwise <tt>*</tt><i>ok</i> is set to true.</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;1234.56&quot;</span>;
 <span class="type">double</span> val <span class="operator">=</span> str<span class="operator">.</span>toDouble();   <span class="comment">// val == 1234.56</span></pre>
<p>Various string formats for floating point numbers can be converted to double values:</p>
<pre class="cpp"> <span class="type">bool</span> ok;
 <span class="type">double</span> d;

 d <span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span>( <span class="string">&quot;1234.56e-02&quot;</span> )<span class="operator">.</span>toDouble(<span class="operator">&amp;</span>ok); <span class="comment">// ok == true, d == 12.3456</span></pre>
<p>This function tries to interpret the string according to the current locale. The current locale is determined from the system at application startup and can be changed by calling <a href="qlocale.html#setDefault">QLocale::setDefault</a>(). If the string cannot be interpreted according to the current locale, this function falls back on the &quot;C&quot; locale.</p>
<pre class="cpp"> <span class="type"><a href="qlocale.html">QLocale</a></span><span class="operator">::</span>setDefault(<span class="type"><a href="qlocale.html">QLocale</a></span><span class="operator">::</span>C);
 d <span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span>( <span class="string">&quot;1234,56&quot;</span> )<span class="operator">.</span>toDouble(<span class="operator">&amp;</span>ok); <span class="comment">// ok == false</span>
 d <span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span>( <span class="string">&quot;1234.56&quot;</span> )<span class="operator">.</span>toDouble(<span class="operator">&amp;</span>ok); <span class="comment">// ok == true, d == 1234.56</span>

 <span class="type"><a href="qlocale.html">QLocale</a></span><span class="operator">::</span>setDefault(<span class="type"><a href="qlocale.html">QLocale</a></span><span class="operator">::</span>German);
 d <span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span>( <span class="string">&quot;1234,56&quot;</span> )<span class="operator">.</span>toDouble(<span class="operator">&amp;</span>ok); <span class="comment">// ok == true, d == 1234.56</span>
 d <span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span>( <span class="string">&quot;1234.56&quot;</span> )<span class="operator">.</span>toDouble(<span class="operator">&amp;</span>ok); <span class="comment">// ok == true, d == 1234.56</span></pre>
<p>Due to the ambiguity between the decimal point and thousands group separator in various locales, this function does not handle thousands group separators. If you need to convert such numbers, see <a href="qlocale.html#toDouble">QLocale::toDouble</a>().</p>
<pre class="cpp"> <span class="type"><a href="qlocale.html">QLocale</a></span><span class="operator">::</span>setDefault(<span class="type"><a href="qlocale.html">QLocale</a></span><span class="operator">::</span>C);
 d <span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span>( <span class="string">&quot;1234,56&quot;</span> )<span class="operator">.</span>toDouble(<span class="operator">&amp;</span>ok); <span class="comment">// ok == false</span></pre>
<p><b>See also </b><a href="qstring.html#number">number</a>(), <a href="qlocale.html#setDefault">QLocale::setDefault</a>(), <a href="qlocale.html#toDouble">QLocale::toDouble</a>(), and <a href="qstring.html#trimmed">trimmed</a>().</p>
<!-- @@@toDouble -->
<!-- $$$toFloat[overload1]$$$toFloatbool* -->
<h3 class="fn"><a name="toFloat"></a><span class="type">float</span> QString::<span class="name">toFloat</span> ( <span class="type">bool</span> * <i>ok</i> = 0 ) const</h3>
<p>Returns the string converted to a <tt>float</tt> value.</p>
<p>If a conversion error occurs, *<i>ok</i> is set to false; otherwise *<i>ok</i> is set to true. Returns 0.0 if the conversion fails.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str1 <span class="operator">=</span> <span class="string">&quot;1234.56&quot;</span>;
 str1<span class="operator">.</span>toFloat();             <span class="comment">// returns 1234.56</span>

 <span class="type">bool</span> ok;
 <span class="type"><a href="qstring.html">QString</a></span> str2 <span class="operator">=</span> <span class="string">&quot;R2D2&quot;</span>;
 str2<span class="operator">.</span>toFloat(<span class="operator">&amp;</span>ok);          <span class="comment">// returns 0.0, sets ok to false</span></pre>
<p><b>See also </b><a href="qstring.html#number">number</a>(), <a href="qstring.html#toDouble">toDouble</a>(), and <a href="qstring.html#toInt">toInt</a>().</p>
<!-- @@@toFloat -->
<!-- $$$toInt[overload1]$$$toIntbool*int -->
<h3 class="fn"><a name="toInt"></a><span class="type">int</span> QString::<span class="name">toInt</span> ( <span class="type">bool</span> * <i>ok</i> = 0, <span class="type">int</span> <i>base</i> = 10 ) const</h3>
<p>Returns the string converted to an <tt>int</tt> using base <i>base</i>, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.</p>
<p>If a conversion error occurs, *<i>ok</i> is set to false; otherwise *<i>ok</i> is set to true.</p>
<p>If <i>base</i> is 0, the C language convention is used: If the string begins with &quot;0x&quot;, base 16 is used; if the string begins with &quot;0&quot;, base 8 is used; otherwise, base 10 is used.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;FF&quot;</span>;
 <span class="type">bool</span> ok;
 <span class="type">int</span> hex <span class="operator">=</span> str<span class="operator">.</span>toInt(<span class="operator">&amp;</span>ok<span class="operator">,</span> <span class="number">16</span>);       <span class="comment">// hex == 255, ok == true</span>
 <span class="type">int</span> dec <span class="operator">=</span> str<span class="operator">.</span>toInt(<span class="operator">&amp;</span>ok<span class="operator">,</span> <span class="number">10</span>);       <span class="comment">// dec == 0, ok == false</span></pre>
<p><b>See also </b><a href="qstring.html#number">number</a>(), <a href="qstring.html#toUInt">toUInt</a>(), and <a href="qstring.html#toDouble">toDouble</a>().</p>
<!-- @@@toInt -->
<!-- $$$toLatin1[overload1]$$$toLatin1 -->
<h3 class="fn"><a name="toLatin1"></a><span class="type"><a href="qbytearray.html">QByteArray</a></span> QString::<span class="name">toLatin1</span> () const</h3>
<p>Returns a Latin-1 representation of the string as a <a href="qbytearray.html">QByteArray</a>.</p>
<p>The returned byte array is undefined if the string contains non-Latin1 characters. Those characters may be suppressed or replaced with a question mark.</p>
<p><b>See also </b><a href="qstring.html#fromLatin1">fromLatin1</a>(), <a href="qstring.html#toAscii">toAscii</a>(), <a href="qstring.html#toUtf8">toUtf8</a>(), <a href="qstring.html#toLocal8Bit">toLocal8Bit</a>(), and <a href="qtextcodec.html">QTextCodec</a>.</p>
<!-- @@@toLatin1 -->
<!-- $$$toLocal8Bit[overload1]$$$toLocal8Bit -->
<h3 class="fn"><a name="toLocal8Bit"></a><span class="type"><a href="qbytearray.html">QByteArray</a></span> QString::<span class="name">toLocal8Bit</span> () const</h3>
<p>Returns the local 8-bit representation of the string as a <a href="qbytearray.html">QByteArray</a>. The returned byte array is undefined if the string contains characters not supported by the local 8-bit encoding.</p>
<p><a href="qtextcodec.html#codecForLocale">QTextCodec::codecForLocale</a>() is used to perform the conversion from Unicode. If the locale encoding could not be determined, this function does the same as <a href="qstring.html#toLatin1">toLatin1</a>().</p>
<p>If this string contains any characters that cannot be encoded in the locale, the returned byte array is undefined. Those characters may be suppressed or replaced by another.</p>
<p><b>See also </b><a href="qstring.html#fromLocal8Bit">fromLocal8Bit</a>(), <a href="qstring.html#toAscii">toAscii</a>(), <a href="qstring.html#toLatin1">toLatin1</a>(), <a href="qstring.html#toUtf8">toUtf8</a>(), and <a href="qtextcodec.html">QTextCodec</a>.</p>
<!-- @@@toLocal8Bit -->
<!-- $$$toLong[overload1]$$$toLongbool*int -->
<h3 class="fn"><a name="toLong"></a><span class="type">long</span> QString::<span class="name">toLong</span> ( <span class="type">bool</span> * <i>ok</i> = 0, <span class="type">int</span> <i>base</i> = 10 ) const</h3>
<p>Returns the string converted to a <tt>long</tt> using base <i>base</i>, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.</p>
<p>If a conversion error occurs, *<i>ok</i> is set to false; otherwise *<i>ok</i> is set to true.</p>
<p>If <i>base</i> is 0, the C language convention is used: If the string begins with &quot;0x&quot;, base 16 is used; if the string begins with &quot;0&quot;, base 8 is used; otherwise, base 10 is used.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;FF&quot;</span>;
 <span class="type">bool</span> ok;

 <span class="type">long</span> hex <span class="operator">=</span> str<span class="operator">.</span>toLong(<span class="operator">&amp;</span>ok<span class="operator">,</span> <span class="number">16</span>);     <span class="comment">// hex == 255, ok == true</span>
 <span class="type">long</span> dec <span class="operator">=</span> str<span class="operator">.</span>toLong(<span class="operator">&amp;</span>ok<span class="operator">,</span> <span class="number">10</span>);     <span class="comment">// dec == 0, ok == false</span></pre>
<p><b>See also </b><a href="qstring.html#number">number</a>(), <a href="qstring.html#toULong">toULong</a>(), and <a href="qstring.html#toInt">toInt</a>().</p>
<!-- @@@toLong -->
<!-- $$$toLongLong[overload1]$$$toLongLongbool*int -->
<h3 class="fn"><a name="toLongLong"></a><span class="type"><a href="qtglobal.html#qlonglong-typedef">qlonglong</a></span> QString::<span class="name">toLongLong</span> ( <span class="type">bool</span> * <i>ok</i> = 0, <span class="type">int</span> <i>base</i> = 10 ) const</h3>
<p>Returns the string converted to a <tt>long long</tt> using base <i>base</i>, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.</p>
<p>If a conversion error occurs, *<i>ok</i> is set to false; otherwise *<i>ok</i> is set to true.</p>
<p>If <i>base</i> is 0, the C language convention is used: If the string begins with &quot;0x&quot;, base 16 is used; if the string begins with &quot;0&quot;, base 8 is used; otherwise, base 10 is used.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;FF&quot;</span>;
 <span class="type">bool</span> ok;

 <span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> hex <span class="operator">=</span> str<span class="operator">.</span>toLongLong(<span class="operator">&amp;</span>ok<span class="operator">,</span> <span class="number">16</span>);      <span class="comment">// hex == 255, ok == true</span>
 <span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> dec <span class="operator">=</span> str<span class="operator">.</span>toLongLong(<span class="operator">&amp;</span>ok<span class="operator">,</span> <span class="number">10</span>);      <span class="comment">// dec == 0, ok == false</span></pre>
<p><b>See also </b><a href="qstring.html#number">number</a>(), <a href="qstring.html#toULongLong">toULongLong</a>(), and <a href="qstring.html#toInt">toInt</a>().</p>
<!-- @@@toLongLong -->
<!-- $$$toLower[overload1]$$$toLower -->
<h3 class="fn"><a name="toLower"></a><span class="type">QString</span> QString::<span class="name">toLower</span> () const</h3>
<p>Returns a lowercase copy of the string.</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;Qt by NOKIA&quot;</span>;
 str <span class="operator">=</span> str<span class="operator">.</span>toLower();        <span class="comment">// str == &quot;qt by nokia&quot;</span></pre>
<p>The case conversion will always happen in the 'C' locale. For locale dependent case folding use <a href="qlocale.html#toLower">QLocale::toLower</a>()</p>
<p><b>See also </b><a href="qstring.html#toUpper">toUpper</a>() and <a href="qlocale.html#toLower">QLocale::toLower</a>().</p>
<!-- @@@toLower -->
<!-- $$$toShort[overload1]$$$toShortbool*int -->
<h3 class="fn"><a name="toShort"></a><span class="type">short</span> QString::<span class="name">toShort</span> ( <span class="type">bool</span> * <i>ok</i> = 0, <span class="type">int</span> <i>base</i> = 10 ) const</h3>
<p>Returns the string converted to a <tt>short</tt> using base <i>base</i>, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.</p>
<p>If a conversion error occurs, *<i>ok</i> is set to false; otherwise *<i>ok</i> is set to true.</p>
<p>If <i>base</i> is 0, the C language convention is used: If the string begins with &quot;0x&quot;, base 16 is used; if the string begins with &quot;0&quot;, base 8 is used; otherwise, base 10 is used.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;FF&quot;</span>;
 <span class="type">bool</span> ok;

 <span class="type">short</span> hex <span class="operator">=</span> str<span class="operator">.</span>toShort(<span class="operator">&amp;</span>ok<span class="operator">,</span> <span class="number">16</span>);   <span class="comment">// hex == 255, ok == true</span>
 <span class="type">short</span> dec <span class="operator">=</span> str<span class="operator">.</span>toShort(<span class="operator">&amp;</span>ok<span class="operator">,</span> <span class="number">10</span>);   <span class="comment">// dec == 0, ok == false</span></pre>
<p><b>See also </b><a href="qstring.html#number">number</a>(), <a href="qstring.html#toUShort">toUShort</a>(), and <a href="qstring.html#toInt">toInt</a>().</p>
<!-- @@@toShort -->
<!-- $$$toStdString[overload1]$$$toStdString -->
<h3 class="fn"><a name="toStdString"></a><span class="type">std::string</span> QString::<span class="name">toStdString</span> () const</h3>
<p>Returns a std::string object with the data contained in this <a href="qstring.html">QString</a>. The Unicode data is converted into 8-bit characters using the <a href="qstring.html#toAscii">toAscii</a>() function.</p>
<p>This operator is mostly useful to pass a <a href="qstring.html">QString</a> to a function that accepts a std::string object.</p>
<p>If the <a href="qstring.html">QString</a> contains Unicode characters that the <a href="qtextcodec.html#codecForCStrings">QTextCodec::codecForCStrings</a>() codec cannot handle, using this operator can lead to loss of information.</p>
<p>This operator is only available if Qt is configured with STL compatibility enabled.</p>
<p><b>See also </b><a href="qstring.html#toAscii">toAscii</a>(), <a href="qstring.html#toLatin1">toLatin1</a>(), <a href="qstring.html#toUtf8">toUtf8</a>(), and <a href="qstring.html#toLocal8Bit">toLocal8Bit</a>().</p>
<!-- @@@toStdString -->
<!-- $$$toStdWString[overload1]$$$toStdWString -->
<h3 class="fn"><a name="toStdWString"></a><span class="type">std::wstring</span> QString::<span class="name">toStdWString</span> () const</h3>
<p>Returns a std::wstring object with the data contained in this <a href="qstring.html">QString</a>. The std::wstring is encoded in utf16 on platforms where wchar_t is 2 bytes wide (e.g&#x2e; windows) and in ucs4 on platforms where wchar_t is 4 bytes wide (most Unix systems).</p>
<p>This operator is mostly useful to pass a <a href="qstring.html">QString</a> to a function that accepts a std::wstring object.</p>
<p>This operator is only available if Qt is configured with STL compatibility enabled.</p>
<p><b>See also </b><a href="qstring.html#utf16">utf16</a>(), <a href="qstring.html#toAscii">toAscii</a>(), <a href="qstring.html#toLatin1">toLatin1</a>(), <a href="qstring.html#toUtf8">toUtf8</a>(), and <a href="qstring.html#toLocal8Bit">toLocal8Bit</a>().</p>
<!-- @@@toStdWString -->
<!-- $$$toUInt[overload1]$$$toUIntbool*int -->
<h3 class="fn"><a name="toUInt"></a><span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> QString::<span class="name">toUInt</span> ( <span class="type">bool</span> * <i>ok</i> = 0, <span class="type">int</span> <i>base</i> = 10 ) const</h3>
<p>Returns the string converted to an <tt>unsigned int</tt> using base <i>base</i>, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.</p>
<p>If a conversion error occurs, *<i>ok</i> is set to false; otherwise *<i>ok</i> is set to true.</p>
<p>If <i>base</i> is 0, the C language convention is used: If the string begins with &quot;0x&quot;, base 16 is used; if the string begins with &quot;0&quot;, base 8 is used; otherwise, base 10 is used.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;FF&quot;</span>;
 <span class="type">bool</span> ok;

 <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> hex <span class="operator">=</span> str<span class="operator">.</span>toUInt(<span class="operator">&amp;</span>ok<span class="operator">,</span> <span class="number">16</span>);     <span class="comment">// hex == 255, ok == true</span>
 <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> dec <span class="operator">=</span> str<span class="operator">.</span>toUInt(<span class="operator">&amp;</span>ok<span class="operator">,</span> <span class="number">10</span>);     <span class="comment">// dec == 0, ok == false</span></pre>
<p><b>See also </b><a href="qstring.html#number">number</a>() and <a href="qstring.html#toInt">toInt</a>().</p>
<!-- @@@toUInt -->
<!-- $$$toULong[overload1]$$$toULongbool*int -->
<h3 class="fn"><a name="toULong"></a><span class="type"><a href="qtglobal.html#ulong-typedef">ulong</a></span> QString::<span class="name">toULong</span> ( <span class="type">bool</span> * <i>ok</i> = 0, <span class="type">int</span> <i>base</i> = 10 ) const</h3>
<p>Returns the string converted to an <tt>unsigned long</tt> using base <i>base</i>, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.</p>
<p>If a conversion error occurs, *<i>ok</i> is set to false; otherwise *<i>ok</i> is set to true.</p>
<p>If <i>base</i> is 0, the C language convention is used: If the string begins with &quot;0x&quot;, base 16 is used; if the string begins with &quot;0&quot;, base 8 is used; otherwise, base 10 is used.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;FF&quot;</span>;
 <span class="type">bool</span> ok;

 <span class="type"><a href="qtglobal.html#ulong-typedef">ulong</a></span> hex <span class="operator">=</span> str<span class="operator">.</span>toULong(<span class="operator">&amp;</span>ok<span class="operator">,</span> <span class="number">16</span>);   <span class="comment">// hex == 255, ok == true</span>
 <span class="type"><a href="qtglobal.html#ulong-typedef">ulong</a></span> dec <span class="operator">=</span> str<span class="operator">.</span>toULong(<span class="operator">&amp;</span>ok<span class="operator">,</span> <span class="number">10</span>);   <span class="comment">// dec == 0, ok == false</span></pre>
<p><b>See also </b><a href="qstring.html#number">number</a>().</p>
<!-- @@@toULong -->
<!-- $$$toULongLong[overload1]$$$toULongLongbool*int -->
<h3 class="fn"><a name="toULongLong"></a><span class="type"><a href="qtglobal.html#qulonglong-typedef">qulonglong</a></span> QString::<span class="name">toULongLong</span> ( <span class="type">bool</span> * <i>ok</i> = 0, <span class="type">int</span> <i>base</i> = 10 ) const</h3>
<p>Returns the string converted to an <tt>unsigned long long</tt> using base <i>base</i>, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.</p>
<p>If a conversion error occurs, *<i>ok</i> is set to false; otherwise *<i>ok</i> is set to true.</p>
<p>If <i>base</i> is 0, the C language convention is used: If the string begins with &quot;0x&quot;, base 16 is used; if the string begins with &quot;0&quot;, base 8 is used; otherwise, base 10 is used.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;FF&quot;</span>;
 <span class="type">bool</span> ok;

 <span class="type"><a href="qtglobal.html#quint64-typedef">quint64</a></span> hex <span class="operator">=</span> str<span class="operator">.</span>toULongLong(<span class="operator">&amp;</span>ok<span class="operator">,</span> <span class="number">16</span>);    <span class="comment">// hex == 255, ok == true</span>
 <span class="type"><a href="qtglobal.html#quint64-typedef">quint64</a></span> dec <span class="operator">=</span> str<span class="operator">.</span>toULongLong(<span class="operator">&amp;</span>ok<span class="operator">,</span> <span class="number">10</span>);    <span class="comment">// dec == 0, ok == false</span></pre>
<p><b>See also </b><a href="qstring.html#number">number</a>() and <a href="qstring.html#toLongLong">toLongLong</a>().</p>
<!-- @@@toULongLong -->
<!-- $$$toUShort[overload1]$$$toUShortbool*int -->
<h3 class="fn"><a name="toUShort"></a><span class="type"><a href="qtglobal.html#ushort-typedef">ushort</a></span> QString::<span class="name">toUShort</span> ( <span class="type">bool</span> * <i>ok</i> = 0, <span class="type">int</span> <i>base</i> = 10 ) const</h3>
<p>Returns the string converted to an <tt>unsigned short</tt> using base <i>base</i>, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.</p>
<p>If a conversion error occurs, *<i>ok</i> is set to false; otherwise *<i>ok</i> is set to true.</p>
<p>If <i>base</i> is 0, the C language convention is used: If the string begins with &quot;0x&quot;, base 16 is used; if the string begins with &quot;0&quot;, base 8 is used; otherwise, base 10 is used.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;FF&quot;</span>;
 <span class="type">bool</span> ok;

 <span class="type"><a href="qtglobal.html#ushort-typedef">ushort</a></span> hex <span class="operator">=</span> str<span class="operator">.</span>toUShort(<span class="operator">&amp;</span>ok<span class="operator">,</span> <span class="number">16</span>);     <span class="comment">// hex == 255, ok == true</span>
 <span class="type"><a href="qtglobal.html#ushort-typedef">ushort</a></span> dec <span class="operator">=</span> str<span class="operator">.</span>toUShort(<span class="operator">&amp;</span>ok<span class="operator">,</span> <span class="number">10</span>);     <span class="comment">// dec == 0, ok == false</span></pre>
<p><b>See also </b><a href="qstring.html#number">number</a>() and <a href="qstring.html#toShort">toShort</a>().</p>
<!-- @@@toUShort -->
<!-- $$$toUcs4[overload1]$$$toUcs4 -->
<h3 class="fn"><a name="toUcs4"></a><span class="type"><a href="qvector.html">QVector</a></span>&lt;<span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span>&gt; QString::<span class="name">toUcs4</span> () const</h3>
<p>Returns a UCS-4/UTF-32 representation of the string as a <a href="qvector.html">QVector</a>&lt;uint&gt;.</p>
<p>UCS-4 is a Unicode codec and is lossless. All characters from this string can be encoded in UCS-4. The vector is not null terminated.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstring.html#fromUtf8">fromUtf8</a>(), <a href="qstring.html#toAscii">toAscii</a>(), <a href="qstring.html#toLatin1">toLatin1</a>(), <a href="qstring.html#toLocal8Bit">toLocal8Bit</a>(), <a href="qtextcodec.html">QTextCodec</a>, <a href="qstring.html#fromUcs4">fromUcs4</a>(), and <a href="qstring.html#toWCharArray">toWCharArray</a>().</p>
<!-- @@@toUcs4 -->
<!-- $$$toUpper[overload1]$$$toUpper -->
<h3 class="fn"><a name="toUpper"></a><span class="type">QString</span> QString::<span class="name">toUpper</span> () const</h3>
<p>Returns an uppercase copy of the string.</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;TeXt&quot;</span>;
 str <span class="operator">=</span> str<span class="operator">.</span>toUpper();        <span class="comment">// str == &quot;TEXT&quot;</span></pre>
<p>The case conversion will always happen in the 'C' locale. For locale dependent case folding use <a href="qlocale.html#toUpper">QLocale::toUpper</a>()</p>
<p><b>See also </b><a href="qstring.html#toLower">toLower</a>() and <a href="qlocale.html#toLower">QLocale::toLower</a>().</p>
<!-- @@@toUpper -->
<!-- $$$toUtf8[overload1]$$$toUtf8 -->
<h3 class="fn"><a name="toUtf8"></a><span class="type"><a href="qbytearray.html">QByteArray</a></span> QString::<span class="name">toUtf8</span> () const</h3>
<p>Returns a UTF-8 representation of the string as a <a href="qbytearray.html">QByteArray</a>.</p>
<p>UTF-8 is a Unicode codec and can represent all characters in a Unicode string like <a href="qstring.html">QString</a>.</p>
<p>However, in the Unicode range, there are certain codepoints that are not considered characters. The Unicode standard reserves the last two codepoints in each Unicode Plane (U+FFFE, U+FFFF, U+1FFFE, U+1FFFF, U+2FFFE, etc.), as well as 16 codepoints in the range U+FDD0..U+FDDF, inclusive, as non-characters. If any of those appear in the string, they may be discarded and will not appear in the UTF-8 representation, or they may be replaced by one or more replacement characters.</p>
<p><b>See also </b><a href="qstring.html#fromUtf8">fromUtf8</a>(), <a href="qstring.html#toAscii">toAscii</a>(), <a href="qstring.html#toLatin1">toLatin1</a>(), <a href="qstring.html#toLocal8Bit">toLocal8Bit</a>(), and <a href="qtextcodec.html">QTextCodec</a>.</p>
<!-- @@@toUtf8 -->
<!-- $$$toWCharArray[overload1]$$$toWCharArraywchar_t* -->
<h3 class="fn"><a name="toWCharArray"></a><span class="type">int</span> QString::<span class="name">toWCharArray</span> ( <span class="type">wchar_t</span> * <i>array</i> ) const</h3>
<p>Fills the <i>array</i> with the data contained in this <a href="qstring.html">QString</a> object. The array is encoded in utf16 on platforms where wchar_t is 2 bytes wide (e.g&#x2e; windows) and in ucs4 on platforms where wchar_t is 4 bytes wide (most Unix systems).</p>
<p><i>array</i> has to be allocated by the caller and contain enough space to hold the complete string (allocating the array with the same length as the string is always sufficient).</p>
<p>returns the actual length of the string in <i>array</i>.</p>
<p><b>Note:</b> This function does not append a null character to the array.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstring.html#utf16">utf16</a>(), <a href="qstring.html#toUcs4">toUcs4</a>(), <a href="qstring.html#toAscii">toAscii</a>(), <a href="qstring.html#toLatin1">toLatin1</a>(), <a href="qstring.html#toUtf8">toUtf8</a>(), <a href="qstring.html#toLocal8Bit">toLocal8Bit</a>(), and <a href="qstring.html#toStdWString">toStdWString</a>().</p>
<!-- @@@toWCharArray -->
<!-- $$$trimmed[overload1]$$$trimmed -->
<h3 class="fn"><a name="trimmed"></a><span class="type">QString</span> QString::<span class="name">trimmed</span> () const</h3>
<p>Returns a string that has whitespace removed from the start and the end.</p>
<p>Whitespace means any character for which <a href="qchar.html#isSpace">QChar::isSpace</a>() returns true. This includes the ASCII characters '\t', '\n', '\v', '\f', '\r', and ' '.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;  lots\t of\nwhitespace\r\n &quot;</span>;
 str <span class="operator">=</span> str<span class="operator">.</span>trimmed();
 <span class="comment">// str == &quot;lots\t of\nwhitespace&quot;</span></pre>
<p>Unlike <a href="qstring.html#simplified">simplified</a>(), trimmed() leaves internal whitespace alone.</p>
<p><b>See also </b><a href="qstring.html#simplified">simplified</a>().</p>
<!-- @@@trimmed -->
<!-- $$$truncate[overload1]$$$truncateint -->
<h3 class="fn"><a name="truncate"></a><span class="type">void</span> QString::<span class="name">truncate</span> ( <span class="type">int</span> <i>position</i> )</h3>
<p>Truncates the string at the given <i>position</i> index.</p>
<p>If the specified <i>position</i> index is beyond the end of the string, nothing happens.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str <span class="operator">=</span> <span class="string">&quot;Vladivostok&quot;</span>;
 str<span class="operator">.</span>truncate(<span class="number">4</span>);
 <span class="comment">// str == &quot;Vlad&quot;</span></pre>
<p>If <i>position</i> is negative, it is equivalent to passing zero.</p>
<p><b>See also </b><a href="qstring.html#chop">chop</a>(), <a href="qstring.html#resize">resize</a>(), and <a href="qstring.html#left">left</a>().</p>
<!-- @@@truncate -->
<!-- $$$unicode[overload1]$$$unicode -->
<h3 class="fn"><a name="unicode"></a>const <span class="type"><a href="qchar.html">QChar</a></span> * QString::<span class="name">unicode</span> () const</h3>
<p>Returns a '\0'-terminated Unicode representation of the string. The result remains valid until the string is modified.</p>
<p><b>See also </b><a href="qstring.html#setUnicode">setUnicode</a>() and <a href="qstring.html#utf16">utf16</a>().</p>
<!-- @@@unicode -->
<!-- $$$utf16[overload1]$$$utf16 -->
<h3 class="fn"><a name="utf16"></a>const <span class="type"><a href="qtglobal.html#ushort-typedef">ushort</a></span> * QString::<span class="name">utf16</span> () const</h3>
<p>Returns the <a href="qstring.html">QString</a> as a '\0'-terminated array of unsigned shorts. The result remains valid until the string is modified.</p>
<p>The returned string is in host byte order.</p>
<p><b>See also </b><a href="qstring.html#setUtf16">setUtf16</a>() and <a href="qstring.html#unicode">unicode</a>().</p>
<!-- @@@utf16 -->
<!-- $$$vsprintf[overload1]$$$vsprintfconstchar*va_list -->
<h3 class="fn"><a name="vsprintf"></a><span class="type">QString</span> &amp; QString::<span class="name">vsprintf</span> ( const <span class="type">char</span> * <i>cformat</i>, <span class="type">va_list</span> <i>ap</i> )</h3>
<p>Equivalent method to <a href="qstring.html#sprintf">sprintf</a>(), but takes a va_list <i>ap</i> instead a list of variable arguments. See the <a href="qstring.html#sprintf">sprintf</a>() documentation for an explanation of <i>cformat</i>.</p>
<p>This method does not call the va_end macro, the caller is responsible to call va_end on <i>ap</i>.</p>
<p><b>See also </b><a href="qstring.html#sprintf">sprintf</a>().</p>
<!-- @@@vsprintf -->
<!-- $$$operator!=[overload1]$$$operator!=constQString& -->
<h3 class="fn"><a name="operator-not-eq"></a><span class="type">bool</span> QString::<span class="name">operator!=</span> ( const <span class="type">QString</span> &amp; <i>other</i> ) const</h3>
<p>Returns true if this string is not equal to string <i>other</i>; otherwise returns false.</p>
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings with <a href="qstring.html#localeAwareCompare">localeAwareCompare</a>().</p>
<!-- @@@operator!= -->
<!-- $$$operator!=$$$operator!=constQLatin1String& -->
<h3 class="fn"><a name="operator-not-eq-2"></a><span class="type">bool</span> QString::<span class="name">operator!=</span> ( const <span class="type"><a href="qlatin1string.html">QLatin1String</a></span> &amp; <i>other</i> ) const</h3>
<p>This function overloads <a href="qstring.html#operator-not-eq">operator!=</a>().</p>
<!-- @@@operator!= -->
<!-- $$$operator!=$$$operator!=constQByteArray& -->
<h3 class="fn"><a name="operator-not-eq-3"></a><span class="type">bool</span> QString::<span class="name">operator!=</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; <i>other</i> ) const</h3>
<p>This function overloads <a href="qstring.html#operator-not-eq">operator!=</a>().</p>
<p>The <i>other</i> byte array is converted to a <a href="qstring.html">QString</a> using the <a href="qstring.html#fromAscii">fromAscii</a>() function. If any NUL characters ('\0') are embedded in the byte array, they will be included in the transformation.</p>
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
<!-- @@@operator!= -->
<!-- $$$operator!=$$$operator!=constchar* -->
<h3 class="fn"><a name="operator-not-eq-4"></a><span class="type">bool</span> QString::<span class="name">operator!=</span> ( const <span class="type">char</span> * <i>other</i> ) const</h3>
<p>This function overloads <a href="qstring.html#operator-not-eq">operator!=</a>().</p>
<p>The <i>other</i> const char pointer is converted to a <a href="qstring.html">QString</a> using the <a href="qstring.html#fromAscii">fromAscii</a>() function.</p>
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
<!-- @@@operator!= -->
<!-- $$$operator+=[overload1]$$$operator+=constQString& -->
<h3 class="fn"><a name="operator-2b-eq"></a><span class="type">QString</span> &amp; QString::<span class="name">operator+=</span> ( const <span class="type">QString</span> &amp; <i>other</i> )</h3>
<p>Appends the string <i>other</i> onto the end of this string and returns a reference to this string.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> x <span class="operator">=</span> <span class="string">&quot;free&quot;</span>;
 <span class="type"><a href="qstring.html">QString</a></span> y <span class="operator">=</span> <span class="string">&quot;dom&quot;</span>;
 x <span class="operator">+</span><span class="operator">=</span> y;
 <span class="comment">// x == &quot;freedom&quot;</span></pre>
<p>This operation is typically very fast (<a href="containers.html#constant-time">constant time</a>), because <a href="qstring.html">QString</a> preallocates extra space at the end of the string data so it can grow without reallocating the entire string each time.</p>
<p><b>See also </b><a href="qstring.html#append">append</a>() and <a href="qstring.html#prepend">prepend</a>().</p>
<!-- @@@operator+= -->
<!-- $$$operator+=$$$operator+=constQLatin1String& -->
<h3 class="fn"><a name="operator-2b-eq-2"></a><span class="type">QString</span> &amp; QString::<span class="name">operator+=</span> ( const <span class="type"><a href="qlatin1string.html">QLatin1String</a></span> &amp; <i>str</i> )</h3>
<p>This function overloads <a href="qstring.html#operator-2b-eq">operator+=</a>().</p>
<p>Appends the Latin-1 string <i>str</i> to this string.</p>
<!-- @@@operator+= -->
<!-- $$$operator+=$$$operator+=constQByteArray& -->
<h3 class="fn"><a name="operator-2b-eq-3"></a><span class="type">QString</span> &amp; QString::<span class="name">operator+=</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; <i>ba</i> )</h3>
<p>This function overloads <a href="qstring.html#operator-2b-eq">operator+=</a>().</p>
<p>Appends the byte array <i>ba</i> to this string. The byte array is converted to Unicode using the <a href="qstring.html#fromAscii">fromAscii</a>() function. If any NUL characters ('\0') are embedded in the <i>ba</i> byte array, they will be included in the transformation.</p>
<p>You can disable this function by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
<!-- @@@operator+= -->
<!-- $$$operator+=$$$operator+=constchar* -->
<h3 class="fn"><a name="operator-2b-eq-4"></a><span class="type">QString</span> &amp; QString::<span class="name">operator+=</span> ( const <span class="type">char</span> * <i>str</i> )</h3>
<p>This function overloads <a href="qstring.html#operator-2b-eq">operator+=</a>().</p>
<p>Appends the string <i>str</i> to this string. The const char pointer is converted to Unicode using the <a href="qstring.html#fromAscii">fromAscii</a>() function.</p>
<p>You can disable this function by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
<!-- @@@operator+= -->
<!-- $$$operator+=$$$operator+=constQStringRef& -->
<h3 class="fn"><a name="operator-2b-eq-5"></a><span class="type">QString</span> &amp; QString::<span class="name">operator+=</span> ( const <span class="type"><a href="qstringref.html">QStringRef</a></span> &amp; <i>str</i> )</h3>
<p>This function overloads <a href="qstring.html#operator-2b-eq">operator+=</a>().</p>
<p>Appends the string section referenced by <i>str</i> to this string.</p>
<!-- @@@operator+= -->
<!-- $$$operator+=$$$operator+=char -->
<h3 class="fn"><a name="operator-2b-eq-6"></a><span class="type">QString</span> &amp; QString::<span class="name">operator+=</span> ( <span class="type">char</span> <i>ch</i> )</h3>
<p>This function overloads <a href="qstring.html#operator-2b-eq">operator+=</a>().</p>
<p>Appends the character <i>ch</i> to this string. The character is converted to Unicode using the <a href="qstring.html#fromAscii">fromAscii</a>() function.</p>
<p>You can disable this function by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
<!-- @@@operator+= -->
<!-- $$$operator+=$$$operator+=QChar -->
<h3 class="fn"><a name="operator-2b-eq-7"></a><span class="type">QString</span> &amp; QString::<span class="name">operator+=</span> ( <span class="type"><a href="qchar.html">QChar</a></span> <i>ch</i> )</h3>
<p>This function overloads <a href="qstring.html#operator-2b-eq">operator+=</a>().</p>
<p>Appends the character <i>ch</i> to the string.</p>
<!-- @@@operator+= -->
<!-- $$$operator<[overload1]$$$operator<constQString& -->
<h3 class="fn"><a name="operator-lt"></a><span class="type">bool</span> QString::<span class="name">operator&lt;</span> ( const <span class="type">QString</span> &amp; <i>other</i> ) const</h3>
<p>Returns true if this string is lexically less than string <i>other</i>; otherwise returns false.</p>
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings using the <a href="qstring.html#localeAwareCompare">QString::localeAwareCompare</a>() function.</p>
<!-- @@@operator< -->
<!-- $$$operator<$$$operator<constQLatin1String& -->
<h3 class="fn"><a name="operator-lt-2"></a><span class="type">bool</span> QString::<span class="name">operator&lt;</span> ( const <span class="type"><a href="qlatin1string.html">QLatin1String</a></span> &amp; <i>other</i> ) const</h3>
<p>This function overloads <a href="qstring.html#operator-lt">operator&lt;</a>().</p>
<!-- @@@operator< -->
<!-- $$$operator<$$$operator<constQByteArray& -->
<h3 class="fn"><a name="operator-lt-3"></a><span class="type">bool</span> QString::<span class="name">operator&lt;</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; <i>other</i> ) const</h3>
<p>This function overloads <a href="qstring.html#operator-lt">operator&lt;</a>().</p>
<p>The <i>other</i> byte array is converted to a <a href="qstring.html">QString</a> using the <a href="qstring.html#fromAscii">fromAscii</a>() function. If any NUL characters ('\0') are embedded in the byte array, they will be included in the transformation.</p>
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
<!-- @@@operator< -->
<!-- $$$operator<$$$operator<constchar* -->
<h3 class="fn"><a name="operator-lt-4"></a><span class="type">bool</span> QString::<span class="name">operator&lt;</span> ( const <span class="type">char</span> * <i>other</i> ) const</h3>
<p>This function overloads <a href="qstring.html#operator-lt">operator&lt;</a>().</p>
<p>The <i>other</i> const char pointer is converted to a <a href="qstring.html">QString</a> using the <a href="qstring.html#fromAscii">fromAscii</a>() function.</p>
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
<!-- @@@operator< -->
<!-- $$$operator<=[overload1]$$$operator<=constQString& -->
<h3 class="fn"><a name="operator-lt-eq"></a><span class="type">bool</span> QString::<span class="name">operator&lt;=</span> ( const <span class="type">QString</span> &amp; <i>other</i> ) const</h3>
<p>Returns true if this string is lexically less than or equal to string <i>other</i>; otherwise returns false.</p>
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings with <a href="qstring.html#localeAwareCompare">localeAwareCompare</a>().</p>
<!-- @@@operator<= -->
<!-- $$$operator<=$$$operator<=constQLatin1String& -->
<h3 class="fn"><a name="operator-lt-eq-2"></a><span class="type">bool</span> QString::<span class="name">operator&lt;=</span> ( const <span class="type"><a href="qlatin1string.html">QLatin1String</a></span> &amp; <i>other</i> ) const</h3>
<p>This function overloads <a href="qstring.html#operator-lt-eq">operator&lt;=</a>().</p>
<!-- @@@operator<= -->
<!-- $$$operator<=$$$operator<=constQByteArray& -->
<h3 class="fn"><a name="operator-lt-eq-3"></a><span class="type">bool</span> QString::<span class="name">operator&lt;=</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; <i>other</i> ) const</h3>
<p>This function overloads <a href="qstring.html#operator-lt-eq">operator&lt;=</a>().</p>
<p>The <i>other</i> byte array is converted to a <a href="qstring.html">QString</a> using the <a href="qstring.html#fromAscii">fromAscii</a>() function. If any NUL characters ('\0') are embedded in the byte array, they will be included in the transformation.</p>
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
<!-- @@@operator<= -->
<!-- $$$operator<=$$$operator<=constchar* -->
<h3 class="fn"><a name="operator-lt-eq-4"></a><span class="type">bool</span> QString::<span class="name">operator&lt;=</span> ( const <span class="type">char</span> * <i>other</i> ) const</h3>
<p>This function overloads <a href="qstring.html#operator-lt-eq">operator&lt;=</a>().</p>
<p>The <i>other</i> const char pointer is converted to a <a href="qstring.html">QString</a> using the <a href="qstring.html#fromAscii">fromAscii</a>() function.</p>
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
<!-- @@@operator<= -->
<!-- $$$operator=[overload1]$$$operator=constQString& -->
<h3 class="fn"><a name="operator-eq"></a><span class="type">QString</span> &amp; QString::<span class="name">operator=</span> ( const <span class="type">QString</span> &amp; <i>other</i> )</h3>
<p>Assigns <i>other</i> to this string and returns a reference to this string.</p>
<!-- @@@operator= -->
<!-- $$$operator=$$$operator=constQLatin1String& -->
<h3 class="fn"><a name="operator-eq-3"></a><span class="type">QString</span> &amp; QString::<span class="name">operator=</span> ( const <span class="type"><a href="qlatin1string.html">QLatin1String</a></span> &amp; <i>str</i> )</h3>
<p>This function overloads <a href="qstring.html#operator-eq">operator=</a>().</p>
<p>Assigns the Latin-1 string <i>str</i> to this string.</p>
<!-- @@@operator= -->
<!-- $$$operator=$$$operator=constQByteArray& -->
<h3 class="fn"><a name="operator-eq-4"></a><span class="type">QString</span> &amp; QString::<span class="name">operator=</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; <i>ba</i> )</h3>
<p>This function overloads <a href="qstring.html#operator-eq">operator=</a>().</p>
<p>Assigns <i>ba</i> to this string. The byte array is converted to Unicode using the <a href="qstring.html#fromAscii">fromAscii</a>() function. This function stops conversion at the first NUL character found, or the end of the <i>ba</i> byte array.</p>
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
<!-- @@@operator= -->
<!-- $$$operator=$$$operator=constchar* -->
<h3 class="fn"><a name="operator-eq-5"></a><span class="type">QString</span> &amp; QString::<span class="name">operator=</span> ( const <span class="type">char</span> * <i>str</i> )</h3>
<p>This function overloads <a href="qstring.html#operator-eq">operator=</a>().</p>
<p>Assigns <i>str</i> to this string. The const char pointer is converted to Unicode using the <a href="qstring.html#fromAscii">fromAscii</a>() function.</p>
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
<!-- @@@operator= -->
<!-- $$$operator=$$$operator=char -->
<h3 class="fn"><a name="operator-eq-6"></a><span class="type">QString</span> &amp; QString::<span class="name">operator=</span> ( <span class="type">char</span> <i>ch</i> )</h3>
<p>This function overloads <a href="qstring.html#operator-eq">operator=</a>().</p>
<p>Assigns character <i>ch</i> to this string. The character is converted to Unicode using the <a href="qstring.html#fromAscii">fromAscii</a>() function.</p>
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
<!-- @@@operator= -->
<!-- $$$operator=$$$operator=QChar -->
<h3 class="fn"><a name="operator-eq-7"></a><span class="type">QString</span> &amp; QString::<span class="name">operator=</span> ( <span class="type"><a href="qchar.html">QChar</a></span> <i>ch</i> )</h3>
<p>This function overloads <a href="qstring.html#operator-eq">operator=</a>().</p>
<p>Sets the string to contain the single character <i>ch</i>.</p>
<!-- @@@operator= -->
<!-- $$$operator==[overload1]$$$operator==constQString& -->
<h3 class="fn"><a name="operator-eq-eq"></a><span class="type">bool</span> QString::<span class="name">operator==</span> ( const <span class="type">QString</span> &amp; <i>other</i> ) const</h3>
<p>Returns true if string <i>other</i> is equal to this string; otherwise returns false.</p>
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings with <a href="qstring.html#localeAwareCompare">localeAwareCompare</a>().</p>
<!-- @@@operator== -->
<!-- $$$operator==$$$operator==constQLatin1String& -->
<h3 class="fn"><a name="operator-eq-eq-2"></a><span class="type">bool</span> QString::<span class="name">operator==</span> ( const <span class="type"><a href="qlatin1string.html">QLatin1String</a></span> &amp; <i>other</i> ) const</h3>
<p>This function overloads <a href="qstring.html#operator-eq-eq">operator==</a>().</p>
<!-- @@@operator== -->
<!-- $$$operator==$$$operator==constQByteArray& -->
<h3 class="fn"><a name="operator-eq-eq-3"></a><span class="type">bool</span> QString::<span class="name">operator==</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; <i>other</i> ) const</h3>
<p>This function overloads <a href="qstring.html#operator-eq-eq">operator==</a>().</p>
<p>The <i>other</i> byte array is converted to a <a href="qstring.html">QString</a> using the <a href="qstring.html#fromAscii">fromAscii</a>() function. This function stops conversion at the first NUL character found, or the end of the byte array.</p>
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
<!-- @@@operator== -->
<!-- $$$operator==$$$operator==constchar* -->
<h3 class="fn"><a name="operator-eq-eq-4"></a><span class="type">bool</span> QString::<span class="name">operator==</span> ( const <span class="type">char</span> * <i>other</i> ) const</h3>
<p>This function overloads <a href="qstring.html#operator-eq-eq">operator==</a>().</p>
<p>The <i>other</i> const char pointer is converted to a <a href="qstring.html">QString</a> using the <a href="qstring.html#fromAscii">fromAscii</a>() function.</p>
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
<!-- @@@operator== -->
<!-- $$$operator>[overload1]$$$operator>constQString& -->
<h3 class="fn"><a name="operator-gt"></a><span class="type">bool</span> QString::<span class="name">operator&gt;</span> ( const <span class="type">QString</span> &amp; <i>other</i> ) const</h3>
<p>Returns true if this string is lexically greater than string <i>other</i>; otherwise returns false.</p>
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings with <a href="qstring.html#localeAwareCompare">localeAwareCompare</a>().</p>
<!-- @@@operator> -->
<!-- $$$operator>$$$operator>constQLatin1String& -->
<h3 class="fn"><a name="operator-gt-2"></a><span class="type">bool</span> QString::<span class="name">operator&gt;</span> ( const <span class="type"><a href="qlatin1string.html">QLatin1String</a></span> &amp; <i>other</i> ) const</h3>
<p>This function overloads <a href="qstring.html#operator-gt">operator&gt;</a>().</p>
<!-- @@@operator> -->
<!-- $$$operator>$$$operator>constQByteArray& -->
<h3 class="fn"><a name="operator-gt-3"></a><span class="type">bool</span> QString::<span class="name">operator&gt;</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; <i>other</i> ) const</h3>
<p>This function overloads <a href="qstring.html#operator-gt">operator&gt;</a>().</p>
<p>The <i>other</i> byte array is converted to a <a href="qstring.html">QString</a> using the <a href="qstring.html#fromAscii">fromAscii</a>() function. If any NUL characters ('\0') are embedded in the byte array, they will be included in the transformation.</p>
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
<!-- @@@operator> -->
<!-- $$$operator>$$$operator>constchar* -->
<h3 class="fn"><a name="operator-gt-4"></a><span class="type">bool</span> QString::<span class="name">operator&gt;</span> ( const <span class="type">char</span> * <i>other</i> ) const</h3>
<p>This function overloads <a href="qstring.html#operator-gt">operator&gt;</a>().</p>
<p>The <i>other</i> const char pointer is converted to a <a href="qstring.html">QString</a> using the <a href="qstring.html#fromAscii">fromAscii</a>() function.</p>
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
<!-- @@@operator> -->
<!-- $$$operator>=[overload1]$$$operator>=constQString& -->
<h3 class="fn"><a name="operator-gt-eq"></a><span class="type">bool</span> QString::<span class="name">operator&gt;=</span> ( const <span class="type">QString</span> &amp; <i>other</i> ) const</h3>
<p>Returns true if this string is lexically greater than or equal to string <i>other</i>; otherwise returns false.</p>
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings with <a href="qstring.html#localeAwareCompare">localeAwareCompare</a>().</p>
<!-- @@@operator>= -->
<!-- $$$operator>=$$$operator>=constQLatin1String& -->
<h3 class="fn"><a name="operator-gt-eq-2"></a><span class="type">bool</span> QString::<span class="name">operator&gt;=</span> ( const <span class="type"><a href="qlatin1string.html">QLatin1String</a></span> &amp; <i>other</i> ) const</h3>
<p>This function overloads <a href="qstring.html#operator-gt-eq">operator&gt;=</a>().</p>
<!-- @@@operator>= -->
<!-- $$$operator>=$$$operator>=constQByteArray& -->
<h3 class="fn"><a name="operator-gt-eq-3"></a><span class="type">bool</span> QString::<span class="name">operator&gt;=</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; <i>other</i> ) const</h3>
<p>This function overloads <a href="qstring.html#operator-gt-eq">operator&gt;=</a>().</p>
<p>The <i>other</i> byte array is converted to a <a href="qstring.html">QString</a> using the <a href="qstring.html#fromAscii">fromAscii</a>() function. If any NUL characters ('\0') are embedded in the byte array, they will be included in the transformation.</p>
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
<!-- @@@operator>= -->
<!-- $$$operator>=$$$operator>=constchar* -->
<h3 class="fn"><a name="operator-gt-eq-4"></a><span class="type">bool</span> QString::<span class="name">operator&gt;=</span> ( const <span class="type">char</span> * <i>other</i> ) const</h3>
<p>This function overloads <a href="qstring.html#operator-gt-eq">operator&gt;=</a>().</p>
<p>The <i>other</i> const char pointer is converted to a <a href="qstring.html">QString</a> using the <a href="qstring.html#fromAscii">fromAscii</a>() function.</p>
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p>
<!-- @@@operator>= -->
<!-- $$$operator[][overload1]$$$operator[]int -->
<h3 class="fn"><a name="operator-5b-5d"></a><span class="type">QCharRef</span> QString::<span class="name">operator[]</span> ( <span class="type">int</span> <i>position</i> )</h3>
<p>Returns the character at the specified <i>position</i> in the string as a modifiable reference.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> str;

 <span class="keyword">if</span> (str<span class="operator">[</span><span class="number">0</span><span class="operator">]</span> <span class="operator">=</span><span class="operator">=</span> <span class="type"><a href="qchar.html">QChar</a></span>(<span class="char">'?'</span>))
     str<span class="operator">[</span><span class="number">0</span><span class="operator">]</span> <span class="operator">=</span> <span class="type"><a href="qchar.html">QChar</a></span>(<span class="char">'_'</span>);</pre>
<p>The return value is of type QCharRef, a helper class for <a href="qstring.html">QString</a>. When you get an object of type QCharRef, you can use it as if it were a <a href="qchar.html">QChar</a> &amp;. If you assign to it, the assignment will apply to the character in the <a href="qstring.html">QString</a> from which you got the reference.</p>
<p><b>See also </b><a href="qstring.html#at">at</a>().</p>
<!-- @@@operator[] -->
<!-- $$$operator[]$$$operator[]int -->
<h3 class="fn"><a name="operator-5b-5d-2"></a>const <span class="type"><a href="qchar.html">QChar</a></span> QString::<span class="name">operator[]</span> ( <span class="type">int</span> <i>position</i> ) const</h3>
<p>This function overloads <a href="qstring.html#operator-5b-5d">operator[]</a>().</p>
<!-- @@@operator[] -->
<!-- $$$operator[]$$$operator[]uint -->
<h3 class="fn"><a name="operator-5b-5d-3"></a><span class="type">QCharRef</span> QString::<span class="name">operator[]</span> ( <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> <i>position</i> )</h3>
<p>This function overloads <a href="qstring.html#operator-5b-5d">operator[]</a>().</p>
<p>Returns the character at the specified <i>position</i> in the string as a modifiable reference. Equivalent to <tt>at(position)</tt>.</p>
<!-- @@@operator[] -->
<!-- $$$operator[]$$$operator[]uint -->
<h3 class="fn"><a name="operator-5b-5d-4"></a>const <span class="type"><a href="qchar.html">QChar</a></span> QString::<span class="name">operator[]</span> ( <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> <i>position</i> ) const</h3>
<p>This function overloads <a href="qstring.html#operator-5b-5d">operator[]</a>().</p>
<!-- @@@operator[] -->
</div>
<div class="relnonmem">
<h2>Related Non-Members</h2>
<!-- $$$operator!=$$$operator!=constchar*constQString& -->
<h3 class="fn"><a name="operator-not-eq-10"></a><span class="type">bool</span> <span class="name">operator!=</span> ( const <span class="type">char</span> * <i>s1</i>, const <span class="type">QString</span> &amp; <i>s2</i> )</h3>
<p>Returns true if <i>s1</i> is not equal to <i>s2</i>; otherwise returns false.</p>
<p>For <i>s1</i> != 0, this is equivalent to <tt>compare(</tt> <i>s1</i>, <i>s2</i> <tt>) != 0</tt>. Note that no string is equal to <i>s1</i> being 0.</p>
<p><b>See also </b><a href="qstring.html#compare">QString::compare</a>().</p>
<!-- @@@operator!= -->
<!-- $$$operator+$$$operator+constQString&constQString& -->
<h3 class="fn"><a name="operator-2b-3"></a>const <span class="type">QString</span> <span class="name">operator+</span> ( const <span class="type">QString</span> &amp; <i>s1</i>, const <span class="type">QString</span> &amp; <i>s2</i> )</h3>
<p>Returns a string which is the result of concatenating <i>s1</i> and <i>s2</i>.</p>
<!-- @@@operator+ -->
<!-- $$$operator+$$$operator+constQString&constchar* -->
<h3 class="fn"><a name="operator-2b-6"></a>const <span class="type">QString</span> <span class="name">operator+</span> ( const <span class="type">QString</span> &amp; <i>s1</i>, const <span class="type">char</span> * <i>s2</i> )</h3>
<p>Returns a string which is the result of concatenating <i>s1</i> and <i>s2</i> (<i>s2</i> is converted to Unicode using the <a href="qstring.html#fromAscii">QString::fromAscii</a>() function).</p>
<p><b>See also </b><a href="qstring.html#fromAscii">QString::fromAscii</a>().</p>
<!-- @@@operator+ -->
<!-- $$$operator+$$$operator+constchar*constQString& -->
<h3 class="fn"><a name="operator-2b-7"></a>const <span class="type">QString</span> <span class="name">operator+</span> ( const <span class="type">char</span> * <i>s1</i>, const <span class="type">QString</span> &amp; <i>s2</i> )</h3>
<p>Returns a string which is the result of concatenating <i>s1</i> and <i>s2</i> (<i>s1</i> is converted to Unicode using the <a href="qstring.html#fromAscii">QString::fromAscii</a>() function).</p>
<p><b>See also </b><a href="qstring.html#fromAscii">QString::fromAscii</a>().</p>
<!-- @@@operator+ -->
<!-- $$$operator+$$$operator+charconstQString& -->
<h3 class="fn"><a name="operator-2b-8"></a>const <span class="type">QString</span> <span class="name">operator+</span> ( <span class="type">char</span> <i>ch</i>, const <span class="type">QString</span> &amp; <i>s</i> )</h3>
<p>Returns a string which is the result of concatenating the character <i>ch</i> and the string <i>s</i>.</p>
<!-- @@@operator+ -->
<!-- $$$operator+$$$operator+constQString&char -->
<h3 class="fn"><a name="operator-2b-9"></a>const <span class="type">QString</span> <span class="name">operator+</span> ( const <span class="type">QString</span> &amp; <i>s</i>, <span class="type">char</span> <i>ch</i> )</h3>
<p>Returns a string which is the result of concatenating the string <i>s</i> and the character <i>ch</i>.</p>
<!-- @@@operator+ -->
<!-- $$$operator<$$$operator<constchar*constQString& -->
<h3 class="fn"><a name="operator-lt-3"></a><span class="type">bool</span> <span class="name">operator&lt;</span> ( const <span class="type">char</span> * <i>s1</i>, const <span class="type">QString</span> &amp; <i>s2</i> )</h3>
<p>Returns true if <i>s1</i> is lexically less than <i>s2</i>; otherwise returns false. For <i>s1</i> != 0, this is equivalent to <tt>compare(s1, s2) &lt; 0</tt>.</p>
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings using the <a href="qstring.html#localeAwareCompare">QString::localeAwareCompare</a>() function.</p>
<p><b>See also </b><a href="qstring.html#compare">QString::compare</a>().</p>
<!-- @@@operator< -->
<!-- $$$operator<<$$$operator<<QDataStream&constQString& -->
<h3 class="fn"><a name="operator-lt-lt-29"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <span class="name">operator&lt;&lt;</span> ( <span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <i>stream</i>, const <span class="type">QString</span> &amp; <i>string</i> )</h3>
<p>Writes the given <i>string</i> to the specified <i>stream</i>.</p>
<p><b>See also </b><a href="datastreamformat.html">Serializing Qt Data Types</a>.</p>
<!-- @@@operator<< -->
<!-- $$$operator<=$$$operator<=constchar*constQString& -->
<h3 class="fn"><a name="operator-lt-eq-3"></a><span class="type">bool</span> <span class="name">operator&lt;=</span> ( const <span class="type">char</span> * <i>s1</i>, const <span class="type">QString</span> &amp; <i>s2</i> )</h3>
<p>Returns true if <i>s1</i> is lexically less than or equal to <i>s2</i>; otherwise returns false. For <i>s1</i> != 0, this is equivalent to <tt>compare(s1, s2) &lt;= 0</tt>.</p>
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings with <a href="qstring.html#localeAwareCompare">QString::localeAwareCompare</a>().</p>
<p><b>See also </b><a href="qstring.html#compare">QString::compare</a>().</p>
<!-- @@@operator<= -->
<!-- $$$operator==$$$operator==constchar*constQString& -->
<h3 class="fn"><a name="operator-eq-eq-98"></a><span class="type">bool</span> <span class="name">operator==</span> ( const <span class="type">char</span> * <i>s1</i>, const <span class="type">QString</span> &amp; <i>s2</i> )</h3>
<p>This function overloads <a href="qvector3d.html#operator-eq-eq">operator==</a>().</p>
<p>Returns true if <i>s1</i> is equal to <i>s2</i>; otherwise returns false. Note that no string is equal to <i>s1</i> being 0.</p>
<p>Equivalent to <tt>s1 != 0 &amp;&amp; compare(s1, s2) == 0</tt>.</p>
<p><b>See also </b><a href="qstring.html#compare">QString::compare</a>().</p>
<!-- @@@operator== -->
<!-- $$$operator>$$$operator>constchar*constQString& -->
<h3 class="fn"><a name="operator-gt-3"></a><span class="type">bool</span> <span class="name">operator&gt;</span> ( const <span class="type">char</span> * <i>s1</i>, const <span class="type">QString</span> &amp; <i>s2</i> )</h3>
<p>Returns true if <i>s1</i> is lexically greater than <i>s2</i>; otherwise returns false. Equivalent to <tt>compare(s1, s2) &gt; 0</tt>.</p>
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings using the <a href="qstring.html#localeAwareCompare">QString::localeAwareCompare</a>() function.</p>
<p><b>See also </b><a href="qstring.html#compare">QString::compare</a>().</p>
<!-- @@@operator> -->
<!-- $$$operator>=$$$operator>=constchar*constQString& -->
<h3 class="fn"><a name="operator-gt-eq-3"></a><span class="type">bool</span> <span class="name">operator&gt;=</span> ( const <span class="type">char</span> * <i>s1</i>, const <span class="type">QString</span> &amp; <i>s2</i> )</h3>
<p>Returns true if <i>s1</i> is lexically greater than or equal to <i>s2</i>; otherwise returns false. For <i>s1</i> != 0, this is equivalent to <tt>compare(s1, s2) &gt;= 0</tt>.</p>
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings using the <a href="qstring.html#localeAwareCompare">QString::localeAwareCompare</a>() function.</p>
<!-- @@@operator>= -->
<!-- $$$operator>>$$$operator>>QDataStream&QString& -->
<h3 class="fn"><a name="operator-gt-gt-18"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <span class="name">operator&gt;&gt;</span> ( <span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <i>stream</i>, <span class="type">QString</span> &amp; <i>string</i> )</h3>
<p>Reads a string from the specified <i>stream</i> into the given <i>string</i>.</p>
<p><b>See also </b><a href="datastreamformat.html">Serializing Qt Data Types</a>.</p>
<!-- @@@operator>> -->
</div>
<div class="macros">
<h2>Macro Documentation</h2>
<!-- $$$QT_NO_CAST_FROM_ASCII[overload1]$$$QT_NO_CAST_FROM_ASCII -->
<h3 class="fn"><a name="QT_NO_CAST_FROM_ASCII"></a><span class="name">QT_NO_CAST_FROM_ASCII</span></h3>
<p>Disables automatic conversions from 8-bit strings (char *) to unicode QStrings</p>
<p><b>See also </b><a href="qstring.html#QT_NO_CAST_TO_ASCII">QT_NO_CAST_TO_ASCII</a> and <a href="qbytearray.html#QT_NO_CAST_FROM_BYTEARRAY">QT_NO_CAST_FROM_BYTEARRAY</a>.</p>
<!-- @@@QT_NO_CAST_FROM_ASCII -->
<!-- $$$QT_NO_CAST_TO_ASCII[overload1]$$$QT_NO_CAST_TO_ASCII -->
<h3 class="fn"><a name="QT_NO_CAST_TO_ASCII"></a><span class="name">QT_NO_CAST_TO_ASCII</span></h3>
<p>disables automatic conversion from <a href="qstring.html">QString</a> to 8-bit strings (char *)</p>
<p><b>See also </b><a href="qstring.html#QT_NO_CAST_FROM_ASCII">QT_NO_CAST_FROM_ASCII</a> and <a href="qbytearray.html#QT_NO_CAST_FROM_BYTEARRAY">QT_NO_CAST_FROM_BYTEARRAY</a>.</p>
<!-- @@@QT_NO_CAST_TO_ASCII -->
</div>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2015 The Qt Company Ltd.
      Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      The documentation provided herein is licensed under the terms of the
      <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
      License version 1.3</a> as published by the Free Software Foundation.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Qt and respective logos are trademarks of The Qt Company Ltd 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
  </div>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>