<?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>Aaron Jefferson Villanueva&#039;s Blog Site&#187; Windows Form</title>
	<atom:link href="http://malebolgia.shadowsonawall.net/tag/windows-form/feed" rel="self" type="application/rss+xml" />
	<link>http://malebolgia.shadowsonawall.net</link>
	<description>Programming / Designing Blogging from windows to mac.</description>
	<lastBuildDate>Fri, 20 May 2011 12:05:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Remove number of words&#8230;</title>
		<link>http://malebolgia.shadowsonawall.net/code-programming/remove-number-of-words-at-the-beginning-of-string.html</link>
		<comments>http://malebolgia.shadowsonawall.net/code-programming/remove-number-of-words-at-the-beginning-of-string.html#comments</comments>
		<pubDate>Sat, 01 May 2010 23:12:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.Net (C#/VB)]]></category>
		<category><![CDATA[Coding/Programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[strings]]></category>
		<category><![CDATA[Visual Studio .Net 2008]]></category>
		<category><![CDATA[Windows Form]]></category>

		<guid isPermaLink="false">http://malebolgia.shadowsonawall.net/?p=285</guid>
		<description><![CDATA[Remove number of words at the beginning of string? 

Looking for a function that you want to make string only return the last words within the strings? and remove number of words at the beginning Using C# 


This function could help you:
  


        /// &#60;summary&#62;
   [...]]]></description>
			<content:encoded><![CDATA[<strong>Remove number of words at the beginning of string?</strong> 
<br /><br />
Looking for a function that you want to make string only return the last words within the strings? and remove number of words at the beginning Using <span style="color:#C00"><strong>C#</strong></span></p> <br />
<img src="http://malebolgia.shadowsonawall.net/images/csharp/removewords/01.png" alt="Windows Form Remove words" />
<br /><br />
<strong>This function could help you:</strong>
  <br />


<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">        <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// Return only last several words  and remove the number of words at the beginning from string.</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">string</span> RemoveFirstWords<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> input, <span style="color: #FF0000;">int</span> numberWords<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #0600FF;">try</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> Split <span style="color: #008000;">=</span> input.<span style="color: #0000FF;">Split</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">new</span> <span style="color: #FF0000;">Char</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#123;</span> <span style="color: #666666;">' '</span> <span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                input <span style="color: #008000;">=</span> <span style="color: #FF0000;">string</span>.<span style="color: #0000FF;">Empty</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">//After passing the words to Split - Empty in again</span>
                <span style="color: #0600FF;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> i <span style="color: #008000;">=</span> numberWords<span style="color: #008000;">;</span> i <span style="color: #008000;">&lt;</span> Split.<span style="color: #0000FF;">Count</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span> i<span style="color: #008000;">++</span><span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    input <span style="color: #008000;">+=</span> Convert.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span>Split<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot; &quot;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">//Get Only the last words</span>
                <span style="color: #000000;">&#125;</span>
                <span style="color: #0600FF;">return</span> input<span style="color: #008000;">;</span>
            <span style="color: #000000;">&#125;</span>
            <span style="color: #0600FF;">catch</span> <span style="color: #000000;">&#40;</span>Exception<span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #008080; font-style: italic;">// Log the error.</span>
            <span style="color: #000000;">&#125;</span>
            <span style="color: #0600FF;">return</span> <span style="color: #FF0000;">string</span>.<span style="color: #0000FF;">Empty</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span></pre></div></div>



<strong>Use the function like this:</strong>


<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> removeWords_Click<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> sender, EventArgs e<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>stringToRemove.<span style="color: #0000FF;">Text</span> <span style="color: #008000;">==</span> <span style="color: #FF0000;">string</span>.<span style="color: #0000FF;">Empty</span><span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                MessageBox.<span style="color: #0000FF;">Show</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;The String is Empty&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #000000;">&#125;</span>
            <span style="color: #0600FF;">else</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #FF0000;">int</span> paramNumOfWords <span style="color: #008000;">=</span> Convert.<span style="color: #0000FF;">ToInt16</span><span style="color: #000000;">&#40;</span>numOfwords.<span style="color: #0000FF;">Text</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #FF0000;">string</span> returnOnlyLastWords <span style="color: #008000;">=</span> RemoveFirstWords<span style="color: #000000;">&#40;</span>stringToRemove.<span style="color: #0000FF;">Text</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, paramNumOfWords<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                <span style="color: #008080; font-style: italic;">//Return Words</span>
                MessageBox.<span style="color: #0000FF;">Show</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Return Words: &quot;</span> <span style="color: #008000;">+</span> returnOnlyLastWords<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span></pre></div></div>



<br />
<strong><a href="http://malebolgia.shadowsonawall.net/downloads/StringTest.zip"> Download Source code MVS version 9 C# </a></strong><br /><br />]]></content:encoded>
			<wfw:commentRss>http://malebolgia.shadowsonawall.net/code-programming/remove-number-of-words-at-the-beginning-of-string.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="1" length="" type="" />
		</item>
	</channel>
</rss>

