<?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[Problem mit Strings]]></title><description><![CDATA[<p>Ich soll eine Funktion schreiben namens removeEnd(),die am Ende eines Strings<br />
eine bestimmte Anzahl Zeichen entfernt.<br />
Als ersten Parameter erhält die Funktion den String,als zweiten Parameter die<br />
Anzahl der zu entfernenden Zeichen am Ende des Strings.<br />
Prototypfolgt:<br />
void removeEnd(char*s,int n);<br />
Stringfunktion mit strlen();</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/194870/problem-mit-strings</link><generator>RSS for Node</generator><lastBuildDate>Tue, 18 Aug 2026 07:48:00 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/194870.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 11 Oct 2007 16:44:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit Strings on Thu, 11 Oct 2007 16:44:52 GMT]]></title><description><![CDATA[<p>Ich soll eine Funktion schreiben namens removeEnd(),die am Ende eines Strings<br />
eine bestimmte Anzahl Zeichen entfernt.<br />
Als ersten Parameter erhält die Funktion den String,als zweiten Parameter die<br />
Anzahl der zu entfernenden Zeichen am Ende des Strings.<br />
Prototypfolgt:<br />
void removeEnd(char*s,int n);<br />
Stringfunktion mit strlen();</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1383028</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1383028</guid><dc:creator><![CDATA[Bojan]]></dc:creator><pubDate>Thu, 11 Oct 2007 16:44:52 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Strings on Thu, 11 Oct 2007 16:47:38 GMT]]></title><description><![CDATA[<p>Wie sehen deine konkreten Versuche aus?<br />
Wir machen hier nämlich keine Hausaufgaben...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1383030</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1383030</guid><dc:creator><![CDATA[The-Kenny]]></dc:creator><pubDate>Thu, 11 Oct 2007 16:47:38 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Strings on Thu, 11 Oct 2007 20:31:11 GMT]]></title><description><![CDATA[<p>Bojan schrieb:</p>
<blockquote>
<p>Ich soll eine Funktion schreiben namens removeEnd(),die am Ende eines Strings<br />
eine bestimmte Anzahl Zeichen entfernt.<br />
Als ersten Parameter erhält die Funktion den String,als zweiten Parameter die<br />
Anzahl der zu entfernenden Zeichen am Ende des Strings.<br />
Prototypfolgt:<br />
void removeEnd(char*s,int n);<br />
Stringfunktion mit strlen();</p>
</blockquote>
<p>Das ist ja interessant !</p>
<p>Ich soll gerade eine Marshalling-Schicht zwischen COBOL und Java schreiben.</p>
<p>Gruß,</p>
<p>Simon2.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1383234</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1383234</guid><dc:creator><![CDATA[Simon2]]></dc:creator><pubDate>Thu, 11 Oct 2007 20:31:11 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Strings on Thu, 11 Oct 2007 20:53:26 GMT]]></title><description><![CDATA[<p>So um mal was sinnvolleres beizutragen: Wo genau ist dabei dein Problem? Oder wolltest du die Welt an deiner Aufgabe teil haben lassen? Wartest du darauf, dass dir jemand eine passende Funktion postet?</p>
<p>Letzteres übernehme ich (ja, mir macht es Spaß)</p>
<pre><code class="language-cpp">void CutEndOfString (char *lpString, int iCharsToCut)
{
    int iStringLength = strlen (lpString);
    int iCutting = iStringLength - iCharsToCut;

    int i = iStringLength;
    while (i &gt; iCutting)
    {
        lpString[i] = ' ';
        --i;
    }

    lpString[i] = '\0';
}
</code></pre>
<p>getestet, überarbeitet und funzt.</p>
<p>EDIT: hier nocheinmal überarbeitet:</p>
<pre><code class="language-cpp">void CutEndOfString (char *lpString, int iCharsToCut)
{
    int iStringLength = strlen (lpString);
    if (iStringLength &lt; iCharsToCut)
    {
        strcpy (lpString, &quot;&quot;);
        return;
    }

    int iCutting = iStringLength - iCharsToCut;

    int i = iStringLength;
    while (i &gt; iCutting)
    {
        lpString[i] = ' ';
        --i;
    }

    lpString[i] = '\0';
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1383238</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1383238</guid><dc:creator><![CDATA[Fake oder Echt]]></dc:creator><pubDate>Thu, 11 Oct 2007 20:53:26 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Strings on Thu, 11 Oct 2007 21:01:02 GMT]]></title><description><![CDATA[<p>Wieso eröffnest du den gleichen Thread nochmal im C sharp Forum? Nur weil du zuerst darauf hingewiesen wurdest, dass du keine Frage formuliert hast?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1383243</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1383243</guid><dc:creator><![CDATA[Fake oder Echt]]></dc:creator><pubDate>Thu, 11 Oct 2007 21:01:02 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Strings on Fri, 12 Oct 2007 10:24:08 GMT]]></title><description><![CDATA[<p>Noch ne mögliche Lösung:</p>
<pre><code class="language-cpp">[code]
void removeEnd(char*s,int n)
{
  if (s)
  {
    int p = strlen(s) - n;

    if (p &lt; 0)
    {
      p=0;
    }

    s[p]=0;
  }
}
[/code]
</code></pre>
<p>Aber was das genau macht, musst du schon selbst rauskriegen. <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1383587</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1383587</guid><dc:creator><![CDATA[Burkhi]]></dc:creator><pubDate>Fri, 12 Oct 2007 10:24:08 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Strings on Fri, 12 Oct 2007 10:39:38 GMT]]></title><description><![CDATA[<p>ungetestet</p>
<pre><code class="language-cpp">void DeleteXBack(std::string&amp; strFile, int iCount)
{
    strFile.erase(strFile.length() - iCount, iCount);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1383603</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1383603</guid><dc:creator><![CDATA[EXDW]]></dc:creator><pubDate>Fri, 12 Oct 2007 10:39:38 GMT</pubDate></item></channel></rss>