<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[CString::Format]]></title><description><![CDATA[<p>Hi!<br />
Weiss jemand von Euch wie man einen float-Wert so formatiert, dass alle 3 Stellen Punkte eingefügt werden?<br />
So etwa: 1.000.000 anstatt 1000000.<br />
Bisher mache ich es so:</p>
<pre><code class="language-cpp">CString strZahl;
float fZahl = 1000000;
strZahl.Format(_T(&quot;%.f&quot;), fZahl);
</code></pre>
<p>Macht so aber keine Punkte.<br />
Habt Ihr eine Idee? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>Thx + Gruß Theo</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/68620/cstring-format</link><generator>RSS for Node</generator><lastBuildDate>Sat, 20 Jun 2026 12:53:04 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/68620.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 19 Mar 2004 14:50:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CString::Format on Fri, 19 Mar 2004 14:50:55 GMT]]></title><description><![CDATA[<p>Hi!<br />
Weiss jemand von Euch wie man einen float-Wert so formatiert, dass alle 3 Stellen Punkte eingefügt werden?<br />
So etwa: 1.000.000 anstatt 1000000.<br />
Bisher mache ich es so:</p>
<pre><code class="language-cpp">CString strZahl;
float fZahl = 1000000;
strZahl.Format(_T(&quot;%.f&quot;), fZahl);
</code></pre>
<p>Macht so aber keine Punkte.<br />
Habt Ihr eine Idee? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>Thx + Gruß Theo</p>
]]></description><link>https://www.c-plusplus.net/forum/post/484313</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/484313</guid><dc:creator><![CDATA[Theo]]></dc:creator><pubDate>Fri, 19 Mar 2004 14:50:55 GMT</pubDate></item><item><title><![CDATA[Reply to CString::Format on Fri, 19 Mar 2004 15:08:54 GMT]]></title><description><![CDATA[<p>hier ein Beispiel</p>
<pre><code class="language-cpp">float nFloat = 5.1234567890;

CString temp;
temp.Format(&quot;%.3f&quot;, nFloat);
</code></pre>
<p>Ausgabe:<br />
&quot;5.123&quot;</p>
<p>hoffe das kann dir das verdeutlichen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":-)"
      alt="🙂"
    /><br />
Grüße T1c4L</p>
]]></description><link>https://www.c-plusplus.net/forum/post/484338</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/484338</guid><dc:creator><![CDATA[T1c4L]]></dc:creator><pubDate>Fri, 19 Mar 2004 15:08:54 GMT</pubDate></item><item><title><![CDATA[Reply to CString::Format on Fri, 19 Mar 2004 15:36:22 GMT]]></title><description><![CDATA[<p>Danke schonmal, aber ich glaube ich habe etwas unklar gefragt:<br />
Mir geht es nicht um die Nachkommastellen, sondern darum ein float OHNE Nachkommastellen so auszugeben, dass die dargestellte Zahl mit Punkten gegliedert wird:<br />
Anstatt 1000000 möchte ich 1.000.000 ausgeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/484368</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/484368</guid><dc:creator><![CDATA[Theo]]></dc:creator><pubDate>Fri, 19 Mar 2004 15:36:22 GMT</pubDate></item><item><title><![CDATA[Reply to CString::Format on Fri, 19 Mar 2004 15:43:26 GMT]]></title><description><![CDATA[<p>mhmm mir fällt jetzt auf die schnell nix ein...</p>
<p>aber wie ist es,<br />
wenn du die zahl in CString objekt übergibst und fuer die Ausgabe formatierst?</p>
<p>man soll ja Daten und Ansicht trennen.... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
<p>MfG<br />
T1c4L</p>
]]></description><link>https://www.c-plusplus.net/forum/post/484382</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/484382</guid><dc:creator><![CDATA[T1c4L]]></dc:creator><pubDate>Fri, 19 Mar 2004 15:43:26 GMT</pubDate></item><item><title><![CDATA[Reply to CString::Format on Fri, 19 Mar 2004 18:26:38 GMT]]></title><description><![CDATA[<p>Also ich würd einfach mit GetLengh() die länge des strings abfragen. Dann würde ich mit GetAt(lengh-3) an den ersten punkt gehen, dann mit left() bzw. right() die teile von links und rechts abfragen. Aber achtung mit left und right. Informier dich vorher oder frag nochma wenn du noch nie was damit gemacht hast. Dann einfach NewString.Format(&quot;%s.%s&quot;,left,right).<br />
Und zack haste den ersten punkt. das machste dann so weiter bis schließlich lengh-diepunktstelle ne negative zahl is. Probiers ma aus ich hab nämlich keine ahnung ob das so funtzt. Wenn's probleme gibt, kannste ja noch ma fragen... Ich könnt dir auch ne komlette schleife machen, aber en bisschen spaß willste bestimmt auch ham... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>MFG</p>
<p>Hansi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/484530</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/484530</guid><dc:creator><![CDATA[Hansi]]></dc:creator><pubDate>Fri, 19 Mar 2004 18:26:38 GMT</pubDate></item><item><title><![CDATA[Reply to CString::Format on Fri, 19 Mar 2004 23:59:48 GMT]]></title><description><![CDATA[<p>Thx für Euren Input, ich habe mir jetzt allerdings mit der Win API geholfen:</p>
<pre><code class="language-cpp">int GetNumberFormat(
	LCID Locale,                // locale
	DWORD dwFlags,              // options
	LPCTSTR lpValue,            // input number string
	CONST NUMBERFMT *lpFormat,  // formatting information
	LPTSTR lpNumberStr,         // output buffer
	int cchNumber               // size of output buffer
);
</code></pre>
<p>Trotzdem danke nochmal! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/484706</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/484706</guid><dc:creator><![CDATA[Theo]]></dc:creator><pubDate>Fri, 19 Mar 2004 23:59:48 GMT</pubDate></item><item><title><![CDATA[Reply to CString::Format on Sat, 20 Mar 2004 10:04:00 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>hier noch eine Möglichkeit:</p>
<pre><code class="language-cpp">CString FormatStringToTripleDot(CString s)
{
	CString strTripleDot = _T(&quot;&quot;);
	s = s + &quot;   &quot;;
	int i, t = 0, l = s.GetLength() / 3;
	for (i = 0; i &lt; l ; i++)
	{
		strTripleDot += s.Mid(t, 3);
		strTripleDot += &quot;.&quot;;
		t += 3;
	}
	strTripleDot.TrimRight(&quot;.&quot;);
	strTripleDot.TrimRight();
	strTripleDot.TrimRight(&quot;.&quot;);
	return strTripleDot;
}
</code></pre>
<p>HJA</p>
]]></description><link>https://www.c-plusplus.net/forum/post/484789</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/484789</guid><dc:creator><![CDATA[HJA]]></dc:creator><pubDate>Sat, 20 Mar 2004 10:04:00 GMT</pubDate></item></channel></rss>