<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>NeoEGM.com &#187; String</title>
	<atom:link href="http://www.neoegm.com/tag/string/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.neoegm.com</link>
	<description>Knowledge is inside</description>
	<lastBuildDate>Mon, 08 Jul 2024 05:38:01 +0000</lastBuildDate>
	<language>es-ES</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.2.39</generator>
	<item>
		<title>Clase String simple para C++</title>
		<link>http://www.neoegm.com/es/tech/programming/c-cpp/simple-string-class/</link>
		<comments>http://www.neoegm.com/es/tech/programming/c-cpp/simple-string-class/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 14:12:15 +0000</pubDate>
		<dc:creator><![CDATA[NeoEGM]]></dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Class]]></category>
		<category><![CDATA[Download]]></category>
		<category><![CDATA[Easy]]></category>
		<category><![CDATA[Exercise]]></category>
		<category><![CDATA[Freeware]]></category>
		<category><![CDATA[GNU GPL]]></category>
		<category><![CDATA[Include]]></category>
		<category><![CDATA[Library]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Portable]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Source Code]]></category>
		<category><![CDATA[String]]></category>
		<category><![CDATA[Strings]]></category>
		<category><![CDATA[Teaching]]></category>
		<category><![CDATA[wxDev]]></category>

		<guid isPermaLink="false">http://www.neoegm.com/?p=764</guid>
		<description><![CDATA[Todo programador de C++ sabe que la librería standard tiene una clase string. Pero, mientras se está aprendiendo, es una buena idea saber cómo poder desarrollar tu propia clase string. Esa es la razón por la que hice la clase String. No está pensada para proyectos profesionales (para ellos, deberías utilizar la string de la [&#8230;]<div class='yarpp-related-rss'>
<strong>
Related posts:<ol>
<li><a href="http://www.neoegm.com/es/tech/programming/c-cpp/simple-list-class/" rel="bookmark" title="Clase Lista simple para C++">Clase Lista simple para C++ </a></li>
<li><a href="http://www.neoegm.com/es/tech/programming/c-cpp/control-de-asistencia/" rel="bookmark" title="Control de Asistencia">Control de Asistencia </a></li>
<li><a href="http://www.neoegm.com/es/tech/programming/c-cpp/cppmemdbg-easy-to-use-cpp-memory-leak-detection-library/" rel="bookmark" title="cppMemDbg &#8211; Librería fácil de usar de detección de fugas de memoria para C++">cppMemDbg &#8211; Librería fácil de usar de detección de fugas de memoria para C++ </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Todo programador de C++ sabe que la librería standard tiene una clase <em>string</em>. Pero, mientras se está aprendiendo, es una buena idea saber cómo poder desarrollar tu propia clase <em>string</em>.</p>
<p>Esa es la razón por la que hice la clase <em>String</em>. No está pensada para proyectos profesionales (para ellos, deberías utilizar la <em>string</em> de la librería standard), sino como una ayuda para aprender C++.</p>
<pre class="brush: cpp; title: ; notranslate">
class String
{
	char *m_pszString;	//Allocated buffer
	int m_nAllocated;	//Allocated length

public:
	//Construction and destruction
	String() { /* ... */ }
	~String() { /* ... */ }

	//Copy constructors
	String(const char *pszString) { /* ... */ }
	String(const String&amp; rsString) { /* ... */ }

	//Operators (assignment)
	String&amp; operator=(const char *pszString);
	String&amp; operator=(const String&amp; rsString) { /* ... */ }

	//Operators (concatenation)
	String&amp; operator+=(const char *pszString);
	String&amp; operator+=(String&amp; rsString) { /* ... */ }
	String operator+(String rsString);

	//Operators (comparison)
	bool operator&lt;(String sString) { /* ... */ }
	bool operator&lt;=(String sString) { /* ... */ }

	bool operator&gt;(String sString) { /* ... */ }
	bool operator&gt;=(String sString) { /* ... */ }

	bool operator==(String sString) { /* ... */ }
	bool operator!=(String sString) { /* ... */ }

	//Operations
	void Clear();
	String Lower() { /* ... */ }
	String Upper() { /* ... */ }

	//Information
	int Length() { /* ... */ }

	//Cast operators
	operator const char*() { /* ... */ }

protected:	//Helper functions
	/* ... */
};

//Output e input
std::ostream&amp; operator&lt;&lt;(std::ostream&amp; oStream, String&amp; rsString);
std::istream&amp; operator&gt;&gt;(std::istream&amp; iStream, String&amp; rsString);
</pre>
<p><span id="more-764"></span></p>
<p>Este es un proyecto de ejemplo hecho para explicar la utilización de la clase <em>String</em>.</p>
<pre class="brush: cpp; title: ; notranslate">
#include &lt;iostream&gt;
	using std::cout;
	using std::cin;
	using std::endl;
#include &quot;String.h&quot;

using namespace std;

int main(int argc, char *argv[])
{
	cout &lt;&lt; &quot;String sample project&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;---------------------&quot; &lt;&lt; endl &lt;&lt; endl;

	String a(&quot;This&quot;), b(&quot;is&quot;), c(&quot;a&quot;), d(&quot;test&quot;);
	String e = a + &quot; &quot; + b + &quot; &quot; + c + &quot; &quot; + d;

	cout &lt;&lt; &quot;String parts:&quot; &lt;&lt; endl;
	cout &lt;&lt; '\t' &lt;&lt; a &lt;&lt; endl;
	cout &lt;&lt; '\t' &lt;&lt; b &lt;&lt; endl;
	cout &lt;&lt; '\t' &lt;&lt; c &lt;&lt; endl;
	cout &lt;&lt; '\t' &lt;&lt; d &lt;&lt; endl &lt;&lt; endl;

	cout &lt;&lt; &quot;Concatenated with spaces:&quot; &lt;&lt; endl;
	cout &lt;&lt; '\t' &lt;&lt; e &lt;&lt; endl &lt;&lt; endl;

	String f, g;

	cout &lt;&lt; &quot;Please input a string (empty to break): &quot;;
	cin &gt;&gt; f;
	cout &lt;&lt; &quot;Please input other string (empty to break): &quot;;
	cin &gt;&gt; g;

	cout &lt;&lt; endl;

	cout &lt;&lt; &quot;1st string (&quot; &lt;&lt; f &lt;&lt; &quot;) is &quot; &lt;&lt; f.Length() &lt;&lt; &quot; chars long.&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;2nd string (&quot; &lt;&lt; g &lt;&lt; &quot;) is &quot; &lt;&lt; g.Length() &lt;&lt; &quot; chars long.&quot; &lt;&lt; endl;

	cout &lt;&lt; endl;

	cout &lt;&lt; &quot;1st string in lowercase is &quot; &lt;&lt; f.Lower() &lt;&lt; endl;
	cout &lt;&lt; &quot;1st string in uppercase is &quot; &lt;&lt; f.Upper() &lt;&lt; endl &lt;&lt; endl;

	cout &lt;&lt; &quot;2nd string in lowercase is &quot; &lt;&lt; g.Lower() &lt;&lt; endl;
	cout &lt;&lt; &quot;2nd string in uppercase is &quot; &lt;&lt; g.Upper() &lt;&lt; endl &lt;&lt; endl;

	cout &lt;&lt; &quot;1 &lt; 2\t=&gt; &quot; &lt;&lt; (f&lt;g?&quot;true&quot;:&quot;false&quot;) &lt;&lt; endl;
	cout &lt;&lt; &quot;1 &lt;= 2\t=&gt; &quot; &lt;&lt; (f&lt;=g?&quot;true&quot;:&quot;false&quot;) &lt;&lt; endl;
	cout &lt;&lt; &quot;1 &gt; 2\t=&gt; &quot; &lt;&lt; (f&gt;g?&quot;true&quot;:&quot;false&quot;) &lt;&lt; endl;
	cout &lt;&lt; &quot;1 &gt;= 2\t=&gt; &quot; &lt;&lt; (f&gt;=g?&quot;true&quot;:&quot;false&quot;) &lt;&lt; endl;
	cout &lt;&lt; &quot;1 == 2\t=&gt; &quot; &lt;&lt; (f==g?&quot;true&quot;:&quot;false&quot;) &lt;&lt; endl;
	cout &lt;&lt; &quot;1 != 2\t=&gt; &quot; &lt;&lt; (f!=g?&quot;true&quot;:&quot;false&quot;) &lt;&lt; endl &lt;&lt; endl;

	if (f == g)
		cout &lt;&lt; &quot;Strings are equal.&quot; &lt;&lt; endl;
	else
		cout &lt;&lt; &quot;Strings are not equal.&quot; &lt;&lt; endl;

	cout &lt;&lt; endl;

	cout &lt;&lt; &quot;1+2\t=&gt; &quot; &lt;&lt; f+g &lt;&lt; endl;
	cout &lt;&lt; &quot;2+1\t=&gt; &quot; &lt;&lt; g+f &lt;&lt; endl;

	cout &lt;&lt; endl;

    return 0;
}
</pre>
<p>Y esta su salida:</p>

<pre class="console">
String sample project
---------------------

String parts:
        This
        is
        a
        test

Concatenated with spaces:
        This is a test

Please input a string (empty to break): Hello, string 1
Please input other string (empty to break): Phrase 2

1st string (Hello, string 1) is 15 chars long.
2nd string (Phrase 2) is 8 chars long.

1st string in lowercase is hello, string 1
1st string in uppercase is HELLO, STRING 1

2nd string in lowercase is phrase 2
2nd string in uppercase is PHRASE 2

1 < 2   => false
1 <= 2  => false
1 > 2   => true
1 >= 2  => true
1 == 2  => false
1 != 2  => true

Strings are not equal.

1+2     => Hello, string 1Phrase 2
2+1     => Phrase 2Hello, string 1

</pre>
<p>El código es completamente portable.</p>
<p>Ha sido desarrollado, compilado y testeado utilizando <a href="http://wxdsgn.sourceforge.net/">wxDev-C++</a> para Windows con el <a href="http://www.mingw.org/">compilador MinGW</a> (incluído en el paquete). En Linux, fue compilado utilizando el compilador GNU GCC.</p>
<p><a href="http://www.gnu.org/licenses/gpl-3.0.txt"><img src="http://www.neoegm.com/wp-content/uploads/2009/07/gplv3-127x511.png" alt="GNU GPL v3" title="GNU GPL v3" width="127" height="51" class="aligncenter size-full wp-image-251" /></a> <span class="aligncenter">String está liberado bajo la licencia <a href="http://www.gnu.org/licenses/gpl-3.0.txt">GNU GPL v3</a> (attached)&#8230;</span></p>
<p>Ahora los links de descarga:</p>
<div align="center">
<p class="download"><a href="http://download.neoegm.com/software/string-class/String_1.0.zip">Descargar Clase String 1.0</a></p>
</div>
<div align="center">
<p class="download"><a href="http://download.neoegm.com/software/string-class/String_Sample_Project_1.0.zip">Descargar Proyecto de Ejemplo 1.0</a></p>
</div>
<h4>Incoming search terms for the article:</h4>
<ul>
<li><a href="http://www.neoegm.com/es/tech/programming/c-cpp/simple-string-class/" title="open source c string class">open source c string class</a></li>
<li><a href="http://www.neoegm.com/es/tech/programming/c-cpp/simple-string-class/" title="clase string c">clase string c</a></li>
<li><a href="http://www.neoegm.com/es/tech/programming/c-cpp/simple-string-class/" title="C String Class Source Code">C String Class Source Code</a></li>
<li><a href="http://www.neoegm.com/es/tech/programming/c-cpp/simple-string-class/" title="string c español">string c español</a></li>
<li><a href="http://www.neoegm.com/es/tech/programming/c-cpp/simple-string-class/" title="simple string class c">simple string class c</a></li>
<li><a href="http://www.neoegm.com/es/tech/programming/c-cpp/simple-string-class/" title="simple string class">simple string class</a></li>
<li><a href="http://www.neoegm.com/es/tech/programming/c-cpp/simple-string-class/" title="mail istream al loc:ES">mail istream al loc:ES</a></li>
<li><a href="http://www.neoegm.com/es/tech/programming/c-cpp/simple-string-class/" title="string c">string c</a></li>
<li><a href="http://www.neoegm.com/es/tech/programming/c-cpp/simple-string-class/" title="simple c string class">simple c string class</a></li>
<li><a href="http://www.neoegm.com/es/tech/programming/c-cpp/simple-string-class/" title="c string class source">c string class source</a></li>
</ul>
<div class='yarpp-related-rss'>
<strong><p>Related posts:<ol>
<li><a href="http://www.neoegm.com/es/tech/programming/c-cpp/simple-list-class/" rel="bookmark" title="Clase Lista simple para C++">Clase Lista simple para C++ </a></li>
<li><a href="http://www.neoegm.com/es/tech/programming/c-cpp/control-de-asistencia/" rel="bookmark" title="Control de Asistencia">Control de Asistencia </a></li>
<li><a href="http://www.neoegm.com/es/tech/programming/c-cpp/cppmemdbg-easy-to-use-cpp-memory-leak-detection-library/" rel="bookmark" title="cppMemDbg &#8211; Librería fácil de usar de detección de fugas de memoria para C++">cppMemDbg &#8211; Librería fácil de usar de detección de fugas de memoria para C++ </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.neoegm.com/es/tech/programming/c-cpp/simple-string-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
