<?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>Thuan V. Nguyen &#187; every</title>
	<atom:link href="http://www.a8le.com/tag/every/feed" rel="self" type="application/rss+xml" />
	<link>http://www.a8le.com</link>
	<description>Full steam ahead.</description>
	<lastBuildDate>Thu, 08 Jul 2010 02:45:57 +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>Batch BOL/EOL Editing</title>
		<link>http://www.a8le.com/batch-boleol-editing</link>
		<comments>http://www.a8le.com/batch-boleol-editing#comments</comments>
		<pubDate>Fri, 04 Apr 2008 14:22:09 +0000</pubDate>
		<dc:creator>a8le</dc:creator>
				<category><![CDATA[ASP.net 1.1]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[add]]></category>
		<category><![CDATA[every]]></category>
		<category><![CDATA[line]]></category>

		<guid isPermaLink="false">http://www.a8le.com/archives/44</guid>
		<description><![CDATA[I needed a way of adding periods to the end of every line in text documents.  The text documents in question had 100+ lines, so going through each document and pressing ( END &#62; . &#62; ENTER ) repetitively was not ideal.  I needed a program, but after some brief googling I gave [...]]]></description>
			<content:encoded><![CDATA[<p>I needed a way of adding periods to the end of every line in text documents.  The text documents in question had 100+ lines, so going through each document and pressing ( END &gt; . &gt; ENTER ) repetitively was not ideal.  I needed a program, but after some brief googling I gave up and decided that I needed to write this program.  I started my project by getting some advice and direction, <a href="http://www.vbdotnetforums.com/showthread.php?p=78217#post78217" target="_blank">here</a>, and I am glad I did or else I would have went with my original plan of working with &#8220;regex&#8221; <img src='http://www.a8le.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  &#8230;</p>
<blockquote><p><strike>Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
Dim oFile As System.IO.File<br />
Dim oWrite As System.IO.StreamWriter<br />
Dim Needy As String = tbx_main.Text<br />
Dim Added As String = Regex.Replace(Needy, &#8220;(\p{P})(?=\Z|\r\n)&#8221;, &#8220;.&#8221;)<br />
oWrite.Write(Added)<br />
oWrite.Close()<br />
oWrite = oFile.CreateText(&#8220;C:\Text_to_Speech.txt&#8221;)<br />
End Sub</strike></p></blockquote>
<p>The end result is a little program that adds any desired character(s) to the beginning or end of all lines pasted into its textbox.  The code is as follows&#8230;</p>
<blockquote><p>Try<br />
&#8216;Make sure big tbx is not empty<br />
If tbx_main.Text = &#8220;&#8221; Then<br />
tbx_main.Text = &#8220;Please enter text!&#8221;<br />
ElseIf tbx_main.Text = &#8220;Please enter text!&#8221; Then<br />
tbx_main.Text = &#8220;Please enter text!&#8221;<br />
Else<br />
&#8216;Make sure small tbx is not empty<br />
If tbx_desired.Text = &#8220;&#8221; Then<br />
tbx_desired.Text = &#8220;Char?&#8221;<br />
ElseIf tbx_desired.Text = &#8220;Char?&#8221; Then<br />
tbx_desired.Text = &#8220;Char?&#8221;<br />
Else<br />
&#8216;Declare: file, stream and savefiledialog<br />
Dim oFile As File<br />
Dim oMyStream As Stream<br />
Dim saveFileDialog1 As New SaveFileDialog<br />
&#8216;Set savefiledialog defaults<br />
saveFileDialog1.Filter = &#8220;txt files (*.txt)|*.txt&#8221;<br />
saveFileDialog1.FilterIndex = 2<br />
saveFileDialog1.RestoreDirectory = True<br />
&#8216;Run nested code if user presses OK button in dialog<br />
If saveFileDialog1.ShowDialog() = DialogResult.OK Then<br />
oMyStream = saveFileDialog1.OpenFile()<br />
Dim oWrite As New StreamWriter(oMyStream)<br />
For Each LineInput As String In tbx_main.Lines<br />
&#8216;Core Code, add periods to beginning or end<br />
If rbtn_begin.Checked = True Then<br />
&#8216;Beginning<br />
oWrite.WriteLine(tbx_desired.Text + LineInput)<br />
ElseIf rbtn_end.Checked = True Then<br />
&#8216;End<br />
oWrite.WriteLine(LineInput + tbx_desired.Text)<br />
End If<br />
Next<br />
oWrite.Close()<br />
End If<br />
&#8216;Periods added, display success msgbx, close form<br />
MessageBox.Show(&#8220;Success: file was created!&#8221;)<br />
Me.Dispose()<br />
Me.Close()<br />
End If<br />
End If<br />
Catch exc As Exception<br />
&#8216;Catch Errors, display messagebox<br />
MessageBox.Show(&#8220;Error: file was not created!&#8221;)<br />
End Try</p></blockquote>
<p>Sounds useful? If you want to download the program and use it at your own risk, <a href="http://www.a8le.com/wp-content/uploads/2008/04/periods.zip" title="Period.exe, Batch BOL/EOL Editing">click here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.a8le.com/batch-boleol-editing/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
