<?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>kwatog &#38; co. &#187; string</title>
	<atom:link href="http://kwatog.com/tag/string/feed/" rel="self" type="application/rss+xml" />
	<link>http://kwatog.com</link>
	<description>tech notes and general nonsense</description>
	<lastBuildDate>Wed, 25 Aug 2010 05:46:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Datetime value to string in PHP</title>
		<link>http://kwatog.com/blog/datetime-value-to-string-in-php/</link>
		<comments>http://kwatog.com/blog/datetime-value-to-string-in-php/#comments</comments>
		<pubDate>Sat, 07 Aug 2010 07:09:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[strtotime]]></category>

		<guid isPermaLink="false">http://kwatog.com/?p=379</guid>
		<description><![CDATA[This one escapes me everytime I need which results to much googling. The function is to convert SQL datetime value to human-readable format. /*  *   Converts the likes of '2010-08-01 14:57:15' to 'August 1, 2010, 2:57 pm'  */   $datetime_value ="2010-08-01 14:57:15"; echo date(  "F j, Y, g:i a", strtotime( $datetime_value ) );   Here&#8217;s another example which you will see on some of my templates. &#60;?php echo date('Y-m-d', strtotime('next month')); ?&#62; For more formats, go head to [...]]]></description>
			<content:encoded><![CDATA[<p>This one escapes me everytime I need which results to much googling. The function is to convert SQL datetime value to human-readable format.</p>
<p><code><br />
/* <br />
*   Converts the likes of '2010-08-01 14:57:15' to 'August 1, 2010, 2:57 pm' <br />
*/  <br />
$datetime_value ="2010-08-01 14:57:15";<br />
echo date(  "F j, Y, g:i a", strtotime( $datetime_value ) );  <br />
</code></p>
<p>Here&#8217;s another example which you will see on some of my templates.<br />
<code><br />
&lt;?php echo date('Y-m-d', strtotime('next month')); ?&gt;<br />
</code></p>
<p>For more formats, go head to <a href="http://php.net/manual/en/function.date.php">PHP Doc</a>.</p>
<p>Reference:</p>
<p>http://php.net/manual/en/function.date.php</p>
]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/datetime-value-to-string-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trim String in C++</title>
		<link>http://kwatog.com/blog/c/trim-string-in-c/</link>
		<comments>http://kwatog.com/blog/c/trim-string-in-c/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 07:59:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[standard template library]]></category>
		<category><![CDATA[stl]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[trim]]></category>

		<guid isPermaLink="false">http://kwatog.com/?p=165</guid>
		<description><![CDATA[Funny how a trivial task like trimming trailing spaces in C++ gets a bit harder if you insist on using STL (standard template library). But the good thing is, the internet is there and Google is so good at finding the right answer if you ask the right question. And after reading some samples, I [...]]]></description>
			<content:encoded><![CDATA[<p>Funny how a trivial task like trimming trailing spaces in C++ gets a bit harder if you insist on using STL (standard template library). But the good thing is, the internet is there and Google is so good at finding the right answer if you ask the right question. And after reading some samples, I found the solution.</p>
<p>Here&#8217;s the actual code that I used.<br />
<code>inline string trim_right (const string &#038; s)<br />
{<br />
    size_t found;<br />
    string whitespaces (" \t\n\r");</p>
<p>    string str (s);<br />
	found=str.find_last_not_of(whitespaces);<br />
	if (found!=string::npos){<br />
	   str.erase(found+1);<br />
	}<br />
	else{<br />
	   str.clear();<br />
	}<br />
	return str;<br />
}  </code></p>
<p>here&#8217;s a sample function call<br />
<code><br />
    string str1="lorem ipsum dolor        ";<br />
    string str2=" ";<br />
    str2=trim_right(str1);<br />
    cout << "->|" << str2.c_str() << "|<-";<br />
</code></p>
<p>Here's the shorter version of the code.<br />
<code><br />
   str=str.find_last_not_of(" \t\n\r");<br />
</code></p>
<p>Actually, there could be a ton of other implementation but that's what I'm using. If you know a better way, let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/c/trim-string-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>String Replace in C++</title>
		<link>http://kwatog.com/blog/uncategorized/string-replace-in-c/</link>
		<comments>http://kwatog.com/blog/uncategorized/string-replace-in-c/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 10:43:24 +0000</pubDate>
		<dc:creator>kwatog</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[replace]]></category>
		<category><![CDATA[string]]></category>

		<guid isPermaLink="false">http://kwatog.com/?p=160</guid>
		<description><![CDATA[As I&#8217;m just a C++ poser, I don&#8217;t know a lot of things programming in this language especially if I have to deal with STL (Standard Template Library). As some of you know, when you&#8217;re not using third party libraries in C++, programming gets a little harder (note : my harder is harder than your [...]]]></description>
			<content:encoded><![CDATA[<p>As I&#8217;m just a C++ poser, I don&#8217;t know a lot of things programming in this language especially if I have to deal with STL (Standard Template Library). As some of you know, when you&#8217;re not using third party libraries in C++, programming gets a little harder (<em>note : my harder is harder than your harder</em>). </p>
<p>So I searched the web and found this solution. Unfortunately, I forgot where I got this. Anyway, the original program doesn&#8217;t work.</p>
<p><code>#include <string><br />
#include <iostream></p>
<p>using namespace std;</p>
<p>int main()<br />
{<br />
    string str( "The Horse and the Yokaba" );<br />
    string searchString( "Yokaba" );<br />
    string replaceString( "Kabayo" );</p>
<p>    string::size_type pos = 0;<br />
    while ( (pos = str.find(searchString, pos)) != string::npos ) {<br />
        str.replace( pos, searchString.size(), replaceString );<br />
        pos++;<br />
    }<br />
    cout << str << endl;<br />
    return 0;<br />
}<br />
</code></p>
<p>When I'm using the MString library, it was a breeze. There's a ton of methods that makes things easy but when you need to make your program faster and leaner, you wouldn't want the extra baggage that comes with a third party library. MString is good but it's just brings with it too much things I don't need on my program. </p>
<p>If I have time(which most of the time I spend sleeping), I'll update the post to include a line by line explanation. It's not exactly for you but for me. It's a note to myself. <img src='http://kwatog.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Ciao!</p>
]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/uncategorized/string-replace-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
