<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<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/"
	>

<channel>
	<title>indexof &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/indexof/</link>
	<description>Feed of posts on WordPress.com tagged "indexof"</description>
	<pubDate>Wed, 06 Jan 2010 14:01:25 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[[VB.Net] FindWindowsIndexOf - .Netish Version]]></title>
<link>http://sim0n.wordpress.com/2009/05/05/vbnet-findwindowsindexof-netish/</link>
<pubDate>Tue, 05 May 2009 19:51:15 +0000</pubDate>
<dc:creator>sim0n</dc:creator>
<guid>http://sim0n.wordpress.com/2009/05/05/vbnet-findwindowsindexof-netish/</guid>
<description><![CDATA[A more .net style function for getting a window using an indexOf: ''API Imports &lt;Runtime.InteropS]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>A more .net style function for getting a window using an indexOf:</p>
<div style="border:#660000 5px solid;color:#000000;">
<pre style="background-color:#ffffff;line-height:15px;color:#000000;font-family:Courier New!important;font-size:11px!important;padding:3px;"><span style="color:#000000;">    </span><span style="color:#008000;">''API Imports
</span><span style="color:#000000;">    &#60;Runtime.InteropServices.DllImport(</span><span style="color:#a31515;">"user32.dll"</span><span style="color:#000000;">, CharSet:=Runtime.InteropServices.CharSet.Auto)&#62; </span><span style="color:#0000ff;">Private</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Shared</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Sub</span><span style="color:#000000;"> GetClassName(</span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> hWnd </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> System.IntPtr, </span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> lpClassName </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> System.Text.StringBuilder, </span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> nMaxCount </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Integer</span><span style="color:#000000;">)
    </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Sub
</span><span style="color:#000000;">    &#60;Runtime.InteropServices.DllImport(</span><span style="color:#a31515;">"user32.dll"</span><span style="color:#000000;">, CharSet:=Runtime.InteropServices.CharSet.Auto)&#62; </span><span style="color:#0000ff;">Private</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Shared</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Function</span><span style="color:#000000;"> FindWindow(</span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> lpClassName </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">String</span><span style="color:#000000;">, </span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> lpWindowName </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">String</span><span style="color:#000000;">) </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> IntPtr
    </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Function

</span><span style="color:#000000;">    </span><span style="color:#008000;">''FoundWindow stricture
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">Public</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Structure</span><span style="color:#000000;"> FoundWindow
        </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> strWindowName </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">String
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> strClassName </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">String
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> hWnd </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> IntPtr
    </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Structure

</span><span style="color:#000000;">    </span><span style="color:#008000;">''' </span><span style="color:#808080;">&#60;summary&#62;
</span><span style="color:#000000;">    </span><span style="color:#008000;">''' This function is used to loop through all running processes, checking their main windows to see which ones contain a specific string
</span><span style="color:#000000;">    </span><span style="color:#008000;">''' </span><span style="color:#808080;">&#60;/summary&#62;
</span><span style="color:#000000;">    </span><span style="color:#008000;">''' </span><span style="color:#808080;">&#60;param name="strIndexOf"&#62;</span><span style="color:#008000;">The string that you wish to check for in the window captions</span><span style="color:#808080;">&#60;/param&#62;
</span><span style="color:#000000;">    </span><span style="color:#008000;">''' </span><span style="color:#808080;">&#60;param name="boolCase"&#62;</span><span style="color:#008000;">Whether the function is should check for case</span><span style="color:#808080;">&#60;/param&#62;
</span><span style="color:#000000;">    </span><span style="color:#008000;">''' </span><span style="color:#808080;">&#60;returns&#62;</span><span style="color:#008000;">A list of FoundWindow's containing the window name, class and handle</span><span style="color:#808080;">&#60;/returns&#62;
</span><span style="color:#000000;">    </span><span style="color:#008000;">''' </span><span style="color:#808080;">&#60;remarks&#62;</span><span style="color:#008000;">As this function only loops through running processes main windows, it may miss some windows.</span><span style="color:#808080;">&#60;/remarks&#62;
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">Public</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Function</span><span style="color:#000000;"> FindWindowsIndexOf(</span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> strIndexOf </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">String</span><span style="color:#000000;">, </span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> boolCase </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Boolean</span><span style="color:#000000;">) </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> List(</span><span style="color:#0000ff;">Of</span><span style="color:#000000;"> FoundWindow)
        </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> foundWindows </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">New</span><span style="color:#000000;"> List(</span><span style="color:#0000ff;">Of</span><span style="color:#000000;"> FoundWindow)
        </span><span style="color:#0000ff;">If</span><span style="color:#000000;"> boolCase = </span><span style="color:#0000ff;">False</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Then
</span><span style="color:#000000;">            strIndexOf = strIndexOf.ToLower
        </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">If
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">For</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Each</span><span style="color:#000000;"> p </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> Process </span><span style="color:#0000ff;">In</span><span style="color:#000000;"> Process.GetProcesses
            </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> windowCaption </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">String</span><span style="color:#000000;"> = p.MainWindowTitle
            </span><span style="color:#0000ff;">If</span><span style="color:#000000;"> boolCase = </span><span style="color:#0000ff;">False</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Then
</span><span style="color:#000000;">                windowCaption = windowCaption.ToLower
            </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">If
</span><span style="color:#000000;">            </span><span style="color:#0000ff;">If</span><span style="color:#000000;"> windowCaption.IndexOf(strIndexOf) &#62; -1 </span><span style="color:#0000ff;">Then
</span><span style="color:#000000;">                </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> foundWindow </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">New</span><span style="color:#000000;"> FoundWindow
                foundWindow.hWnd = FindWindow(vbNullString, p.MainWindowTitle)
                foundWindow.strWindowName = p.MainWindowTitle
                </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> sbClassName </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">New</span><span style="color:#000000;"> System.Text.StringBuilder(</span><span style="color:#a31515;">""</span><span style="color:#000000;">, 256)
                GetClassName(foundWindow.hWnd, sbClassName, 256)
                foundWindow.strClassName = sbClassName.ToString
                foundWindows.Add(foundWindow)
            </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">If
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">Next
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">Return</span><span style="color:#000000;"> foundWindows
    </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Function

</span><span style="color:#000000;">    </span><span style="color:#0000ff;">Private</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Sub</span><span style="color:#000000;"> Form1_Load(</span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> sender </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> System.Object, </span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> e </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> System.EventArgs) </span><span style="color:#0000ff;">Handles</span><span style="color:#000000;"> </span><span style="color:#0000ff;">MyBase</span><span style="color:#000000;">.Load
        </span><span style="color:#0000ff;">For</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Each</span><span style="color:#000000;"> fWnd </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> FoundWindow </span><span style="color:#0000ff;">In</span><span style="color:#000000;"> FindWindowsIndexOf(</span><span style="color:#a31515;">"TeST"</span><span style="color:#000000;">, </span><span style="color:#0000ff;">False</span><span style="color:#000000;">)
            Debug.WriteLine(fWnd.strWindowName &#38; </span><span style="color:#a31515;">" : "</span><span style="color:#000000;"> &#38; fWnd.hWnd.ToString)
        </span><span style="color:#0000ff;">Next
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Sub</span></pre>
</div>
<p>Same as the last function, you can choose whether or not the function is case sensitive.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[[VB.Net] FindWindowsIndexOf - API Version]]></title>
<link>http://sim0n.wordpress.com/2009/05/05/vbnet-findwindowsindexof-api-version/</link>
<pubDate>Tue, 05 May 2009 18:29:19 +0000</pubDate>
<dc:creator>sim0n</dc:creator>
<guid>http://sim0n.wordpress.com/2009/05/05/vbnet-findwindowsindexof-api-version/</guid>
<description><![CDATA[Somebody on VBForums was asking how to do something similar to this, so after answering his question]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Somebody on VBForums was asking how to do something similar to this, so after answering his question, I created this fairly useful function &#8211; for windows that names change each time you load them up or something&#8230;</p>
<div style="border:#660000 5px solid;color:#000000;">
<pre style="background-color:#ffffff;line-height:15px;color:#000000;font-family:Courier New!important;font-size:11px!important;padding:3px;"><span style="color:#000000;">    </span><span style="color:#008000;">''API Declarations
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">Private</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Declare</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Function</span><span style="color:#000000;"> EnumWindows </span><span style="color:#0000ff;">Lib</span><span style="color:#000000;"> </span><span style="color:#a31515;">"user32"</span><span style="color:#000000;"> (</span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> lpEnumFunc </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> EnumWindowProc, </span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> lParam </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> IntPtr) </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Integer
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">Private</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Declare</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Function</span><span style="color:#000000;"> GetWindowText </span><span style="color:#0000ff;">Lib</span><span style="color:#000000;"> </span><span style="color:#a31515;">"user32"</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Alias</span><span style="color:#000000;"> </span><span style="color:#a31515;">"GetWindowTextA"</span><span style="color:#000000;"> (</span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> hwnd </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Integer</span><span style="color:#000000;">, </span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> lpString </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> System.Text.StringBuilder, </span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> cch </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Integer</span><span style="color:#000000;">) </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Integer
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">Private</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Declare</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Function</span><span style="color:#000000;"> GetWindowTextLength </span><span style="color:#0000ff;">Lib</span><span style="color:#000000;"> </span><span style="color:#a31515;">"user32"</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Alias</span><span style="color:#000000;"> </span><span style="color:#a31515;">"GetWindowTextLengthA"</span><span style="color:#000000;"> (</span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> hwnd </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Integer</span><span style="color:#000000;">) </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Integer
</span><span style="color:#000000;">    &#60;Runtime.InteropServices.DllImport(</span><span style="color:#a31515;">"user32.dll"</span><span style="color:#000000;">, CharSet:=Runtime.InteropServices.CharSet.Auto)&#62; </span><span style="color:#0000ff;">Private</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Shared</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Sub</span><span style="color:#000000;"> GetClassName(</span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> hWnd </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> System.IntPtr, </span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> lpClassName </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> System.Text.StringBuilder, </span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> nMaxCount </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Integer</span><span style="color:#000000;">)
    </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Sub

</span><span style="color:#000000;">    </span><span style="color:#008000;">''EnumWindow Callback Delegate Function
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">Private</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Delegate</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Function</span><span style="color:#000000;"> EnumWindowProc(</span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> hwnd </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Integer</span><span style="color:#000000;">, </span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> lParam </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> IntPtr) </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Boolean

</span><span style="color:#000000;">    </span><span style="color:#008000;">''Found Window Structures
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">Public</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Structure</span><span style="color:#000000;"> FoundWindows
        </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> boolCase </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Boolean
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> strFindWindow </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">String
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> lstFoundWindows </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> List(</span><span style="color:#0000ff;">Of</span><span style="color:#000000;"> FoundWindow)
    </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Structure
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">Public</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Structure</span><span style="color:#000000;"> FoundWindow
        </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> strWindowName </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">String
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> strClassName </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">String
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> hWnd </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> IntPtr
    </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Structure

</span><span style="color:#000000;">    </span><span style="color:#008000;">''' </span><span style="color:#808080;">&#60;summary&#62;
</span><span style="color:#000000;">    </span><span style="color:#008000;">''' ''EnumWindow Callback Function
</span><span style="color:#000000;">    </span><span style="color:#008000;">''' </span><span style="color:#808080;">&#60;/summary&#62;
</span><span style="color:#000000;">    </span><span style="color:#008000;">''' </span><span style="color:#808080;">&#60;param name="hwnd"&#62;</span><span style="color:#008000;">Current windows handle</span><span style="color:#808080;">&#60;/param&#62;
</span><span style="color:#000000;">    </span><span style="color:#008000;">''' </span><span style="color:#808080;">&#60;param name="lParam"&#62;</span><span style="color:#008000;">Contains the FoundWindows structure</span><span style="color:#808080;">&#60;/param&#62;
</span><span style="color:#000000;">    </span><span style="color:#008000;">''' </span><span style="color:#808080;">&#60;returns&#62;</span><span style="color:#008000;">The function passes the currently found windows in the lParam using a GCHandle to reform the data</span><span style="color:#808080;">&#60;/returns&#62;
</span><span style="color:#000000;">    </span><span style="color:#008000;">''' </span><span style="color:#808080;">&#60;remarks&#62;</span><span style="color:#008000;">This function is called for each of the windows found, and is where the indexOf is called</span><span style="color:#808080;">&#60;/remarks&#62;
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">Public</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Function</span><span style="color:#000000;"> EnumWindowsProc(</span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> hwnd </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Integer</span><span style="color:#000000;">, </span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> lParam </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> IntPtr) </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Boolean
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> foundWindows </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> FoundWindows = </span><span style="color:#0000ff;">CType</span><span style="color:#000000;">(System.Runtime.InteropServices.GCHandle.FromIntPtr(lParam).Target, FoundWindows)
        </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> windowTitle </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">String</span><span style="color:#000000;"> = foundWindows.strFindWindow
        </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> wndTxtLen </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Integer</span><span style="color:#000000;"> = GetWindowTextLength(hwnd)
        </span><span style="color:#0000ff;">If</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Not</span><span style="color:#000000;"> wndTxtLen = 0 </span><span style="color:#0000ff;">Then
</span><span style="color:#000000;">            </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> sb </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">New</span><span style="color:#000000;"> System.Text.StringBuilder(</span><span style="color:#a31515;">""</span><span style="color:#000000;">, wndTxtLen + 1)
            GetWindowText(hwnd, sb, sb.Capacity)
            </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> windowCaption </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">String</span><span style="color:#000000;"> = sb.ToString
            </span><span style="color:#0000ff;">If</span><span style="color:#000000;"> foundWindows.boolCase = </span><span style="color:#0000ff;">False</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Then
</span><span style="color:#000000;">                windowCaption = windowCaption.ToLower
                windowTitle = windowTitle.ToLower
            </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">If
</span><span style="color:#000000;">            </span><span style="color:#0000ff;">If</span><span style="color:#000000;"> windowCaption.IndexOf(windowTitle) &#62; -1 </span><span style="color:#0000ff;">Then
</span><span style="color:#000000;">                </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> foundWindow </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">New</span><span style="color:#000000;"> FoundWindow
                foundWindow.hWnd = </span><span style="color:#0000ff;">CType</span><span style="color:#000000;">(hwnd, IntPtr)
                </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> sbClassName </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">New</span><span style="color:#000000;"> System.Text.StringBuilder(</span><span style="color:#a31515;">""</span><span style="color:#000000;">, 256)
                GetClassName(foundWindow.hWnd, sbClassName, 256)
                foundWindow.strClassName = sbClassName.ToString
                foundWindow.strWindowName = sb.ToString
                foundWindows.lstFoundWindows.Add(foundWindow)
            </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">If
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">If
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">Return</span><span style="color:#000000;"> </span><span style="color:#0000ff;">True
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Function

</span><span style="color:#000000;">    </span><span style="color:#008000;">''' </span><span style="color:#808080;">&#60;summary&#62;
</span><span style="color:#000000;">    </span><span style="color:#008000;">''' This function is used to loop through all open windows and check which ones contain a specific string
</span><span style="color:#000000;">    </span><span style="color:#008000;">''' </span><span style="color:#808080;">&#60;/summary&#62;
</span><span style="color:#000000;">    </span><span style="color:#008000;">''' </span><span style="color:#808080;">&#60;param name="strIndexOf"&#62;</span><span style="color:#008000;">The string that you wish to check for in the window captions</span><span style="color:#808080;">&#60;/param&#62;
</span><span style="color:#000000;">    </span><span style="color:#008000;">''' </span><span style="color:#808080;">&#60;param name="boolCase"&#62;</span><span style="color:#008000;">Whether the function is should check for case</span><span style="color:#808080;">&#60;/param&#62;
</span><span style="color:#000000;">    </span><span style="color:#008000;">''' </span><span style="color:#808080;">&#60;returns&#62;</span><span style="color:#008000;">A FoundWindows structure containing a list of FoundWindow</span><span style="color:#808080;">&#60;/returns&#62;
</span><span style="color:#000000;">    </span><span style="color:#008000;">''' </span><span style="color:#808080;">&#60;remarks&#62;</span><span style="color:#008000;">The FoundWindows structure also contains the strIndexOf that was used to search the windows caption</span><span style="color:#808080;">&#60;/remarks&#62;
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">Public</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Function</span><span style="color:#000000;"> FindWindowsIndexOf(</span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> strIndexOf </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">String</span><span style="color:#000000;">, </span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> boolCase </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Boolean</span><span style="color:#000000;">) </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> FoundWindows
        </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> foundWindows </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> </span><span style="color:#0000ff;">New</span><span style="color:#000000;"> FoundWindows
        foundWindows.boolCase = boolCase
        foundWindows.strFindWindow = strIndexOf
        foundWindows.lstFoundWindows = </span><span style="color:#0000ff;">New</span><span style="color:#000000;"> List(</span><span style="color:#0000ff;">Of</span><span style="color:#000000;"> FoundWindow)
        </span><span style="color:#0000ff;">Dim</span><span style="color:#000000;"> ListHandle </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> System.Runtime.InteropServices.GCHandle = System.Runtime.InteropServices.GCHandle.Alloc(foundWindows)
        </span><span style="color:#0000ff;">Try
</span><span style="color:#000000;">            EnumWindows(</span><span style="color:#0000ff;">AddressOf</span><span style="color:#000000;"> EnumWindowsProc, System.Runtime.InteropServices.GCHandle.ToIntPtr(ListHandle))
        </span><span style="color:#0000ff;">Finally
</span><span style="color:#000000;">            </span><span style="color:#0000ff;">If</span><span style="color:#000000;"> ListHandle.IsAllocated </span><span style="color:#0000ff;">Then</span><span style="color:#000000;"> ListHandle.Free()
        </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Try
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">Return</span><span style="color:#000000;"> foundWindows
    </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Function

</span><span style="color:#000000;">    </span><span style="color:#0000ff;">Private</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Sub</span><span style="color:#000000;"> Form1_Load(</span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> sender </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> System.Object, </span><span style="color:#0000ff;">ByVal</span><span style="color:#000000;"> e </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> System.EventArgs) </span><span style="color:#0000ff;">Handles</span><span style="color:#000000;"> </span><span style="color:#0000ff;">MyBase</span><span style="color:#000000;">.Load
        </span><span style="color:#0000ff;">For</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Each</span><span style="color:#000000;"> fWnd </span><span style="color:#0000ff;">As</span><span style="color:#000000;"> FoundWindow </span><span style="color:#0000ff;">In</span><span style="color:#000000;"> FindWindowsIndexOf(</span><span style="color:#a31515;">"Test"</span><span style="color:#000000;">, </span><span style="color:#0000ff;">True</span><span style="color:#000000;">).lstFoundWindows
            Debug.WriteLine(fWnd.strWindowName &#38; </span><span style="color:#a31515;">" : "</span><span style="color:#000000;"> &#38; fWnd.hWnd.ToString)
        </span><span style="color:#0000ff;">Next
</span><span style="color:#000000;">    </span><span style="color:#0000ff;">End</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Sub</span></pre>
</div>
<p>The function can check for casing as well. For example if you are running two windows one named &#8220;test&#8221; and another named &#8220;Test&#8221; if you use the function like this:</p>
<div style="border:#660000 5px solid;color:#000000;">
<pre style="background-color:#ffffff;line-height:15px;color:#000000;font-family:Courier New!important;font-size:11px!important;padding:3px;"><span style="color:#000000;">FindWindowsIndexOf(</span><span style="color:#a31515;">"Test"</span><span style="color:#000000;">, </span><span style="color:#0000ff;">True</span><span style="color:#000000;">)</span></pre>
</div>
<p>It will only return one window, however if you set the boolCase to false:</p>
<div style="border:#660000 5px solid;color:#000000;">
<pre style="background-color:#ffffff;line-height:15px;color:#000000;font-family:Courier New!important;font-size:11px!important;padding:3px;"><span style="color:#000000;">FindWindowsIndexOf(</span><span style="color:#a31515;">"Test"</span><span style="color:#000000;">, </span><span style="color:#0000ff;">False</span><span style="color:#000000;">)</span></pre>
</div>
<p>It will return both windows</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Sentinels in JavaScript]]></title>
<link>http://dreaminginjavascript.wordpress.com/2009/02/26/sentinels-in-javascript/</link>
<pubDate>Thu, 26 Feb 2009 16:04:19 +0000</pubDate>
<dc:creator>Nosredna</dc:creator>
<guid>http://dreaminginjavascript.wordpress.com/2009/02/26/sentinels-in-javascript/</guid>
<description><![CDATA[Can you find the substring? In older procedural languages, the return values that came back from a f]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><div id="attachment_512" class="wp-caption alignright" style="width: 225px"><img class="size-full wp-image-512 " title="haystack-finalb1" src="http://dreaminginjavascript.wordpress.com/files/2009/02/haystack-finalb1.jpg" alt="Can you find the substring?" width="215" height="150" /><p class="wp-caption-text">Can you find the substring?</p></div>
<p><strong><em>In older procedural languages</em></strong>, the return values that came back from a function were restricted. If you said you were going to return a number, you returned a number. If you wanted to sometimes return a number, but other times return an indication of failure, you resorted to what is known as a &#8220;sentinel value&#8221; to return the failure.</p>
<p>A sentinel value is a number that doesn&#8217;t represent the answer to the problem that the function was asked to solve, but instead flags the caller to the fact that something rather out-of-the-ordinary has happened. For example, a value of -1 can indicate the end of a file being read in.</p>
<p>The problem with a sentinel is that it means nothing special to the language. The programmer has to keep in mind that the sentinel exists and that it has to be handled on every call that could possibly generate the sentinel value. Programmers are notorious for paying attention to and handling sentinels only when they crash a program.</p>
<p>Also, the programmer has to be careful in choosing the value. Is it 0? -1? 99? 255? 999? -999? MAXINT? The choice can bite you if you&#8217;ve misunderstood the possible values that can be generated in your function. I regret to inform you that I once wrote a BASIC program that had three different sentinel values returned from three different subroutines!</p>
<p>Sentinel values sound old and busted, don&#8217;t they? Their usage fell a bit once we could pass around pointers to data structures. With a little more elbow room, we could put a &#8220;success&#8221; boolean right up front in the data structure and do away with a lot of sentinels.</p>
<h2>They Live!</h2>
<p>But sentinels are still around. In JavaScript, the string method &#8220;indexOf&#8221; returns a -1 if the needle (substring) can&#8217;t be found in the haystack (the string to be searched).</p>
<p>Let&#8217;s look at a few different ways we can deal with that awkward -1.</p>
<pre class="brush: jscript;">
function wrappedIndexOf(needle,haystack) {
    var res=haystack.indexOf(needle);
    if (res===-1) {
        res=false;
    }
    return res;
}
</pre>
<p>And you call it like this:</p>
<pre class="brush: jscript;">
res=wrappedIndexOf(needle,haystack);
if (res!==false) {
    location=res;
}
</pre>
<p>We haven&#8217;t done much here but replace the need to check explicitly for <em>-1</em> with a need to check explicitly for <em>false</em>. Too weird to sometimes return a number and sometimes return a boolean? Yeah, probably. I like it a bit better than the numeric sentinel because the calling code makes the exception check a bit more obvious. Because JavaScript functions can return just about anything (including wild things like anonymous functions), you <em>always </em>need to think about what can come out of a function, so what&#8217;s important is a consistent convention.</p>
<p>Similarly, you could return <em>null</em> or <em>undefined.</em></p>
<p>But let&#8217;s move on to another solution&#8211;returning an object.</p>
<pre class="brush: jscript;">
function wrappedIndexOf(needle,haystack) {
    var res=haystack.indexOf(needle);
    if (res===-1) {
        res={&quot;success&quot;:false,&quot;value&quot;:-1};
    } else {
        res={&quot;success&quot;:true,&quot;value&quot;:res};
    }
    return res;
}
</pre>
<p>And you call it like this:</p>
<pre class="brush: jscript;">
obj=wrappedIndexOf(needle,haystack);
if (obj.success) {
    location=obj.value;
}
</pre>
<p><span style="font-family:Georgia;line-height:19px;white-space:normal;">Note that I&#8217;ve left the -1 in obj.value, so you can still use that as a sentinel if you like.</span></p>
<p><span style="font-family:Georgia;line-height:19px;white-space:normal;">What makes JavaScript really good for this task? Its object literals. You don&#8217;t need to have a structure or class around to hold the extra info. You just build the object on the fly and return it.</span></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[String Manipulations]]></title>
<link>http://rizwanparkar.wordpress.com/2009/02/17/string-manipulations/</link>
<pubDate>Tue, 17 Feb 2009 13:24:27 +0000</pubDate>
<dc:creator>rizwanparkar</dc:creator>
<guid>http://rizwanparkar.wordpress.com/2009/02/17/string-manipulations/</guid>
<description><![CDATA[There were many functions we used to parse strings in Classic ASP, like Mid, Right, Left, Instr and ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>There were many functions we used to parse strings in Classic ASP, like Mid, Right, Left, Instr and Len. But now there are new items &#8211; properties assigned to the strings, like Substring, IndexOf, EndsWith, and StartsWith.</p>
<p>Before, we had <em><strong>mid </strong></em>and <em><strong>right</strong></em>. Now we have &#8216;<em>SubString</em>&#8216;. In Classic ASP, to parse just a bit of a string, from a certain position in the string, we would use :</p>
<blockquote>
<pre>Dim sItem
sItem="This is my String"
Mid(sItem,5)</pre>
</blockquote>
<p>This would start 5 characters into the string, and give you what was left. The new way to do it is with the SubString Property. Here&#8217;s how you use it for the same function:</p>
<blockquote>
<pre>Dim sItem as String
sItem="This is my String"
sItem.SubString(5)</pre>
</blockquote>
<p>What you would end up with is &#8216;is my String&#8217;.</p>
<p>One other variation of the SubString property will allow you to start at a certain character (from the left) of the string, and parse the string by a certain number of characters past that starting point. In other words, you could do this:</p>
<blockquote>
<pre>Dim sItem as String
sItem="This is my String"
sItem.SubString(5, 9)</pre>
</blockquote>
<p>The text you would end up with would be &#8216;is my str&#8217;. It started at the 5th character in from the left of the string (just before the word &#8216;is&#8217;) and proceded to crop/parse the text for another 8 characters.</p>
<p>We also previously had the <strong><em>instr</em></strong> function, which, by using it, could find the position in the string of another string. For instance, if the string was &#8220;Where is the big black dog?&#8221; and we wanted to find the position (in that string) of the word &#8220;the&#8221;, we would use the <strong><em>instr</em></strong> function. To do this, the cleanest way possible, we&#8217;d assign the entire string to a variable (let&#8217;s call it &#8217;sItem&#8217;), then, the code would look something like this (including the use of the position, after finding it):</p>
<blockquote>
<pre>Dim lg
lg=instr(1, sItem, "the")
response.Write (lg)</pre>
</blockquote>
<p>Then, of course, we could response.Write lg or use lg in any way we wanted, from there.</p>
<p>Now, we have the <strong><em>indexof </em></strong>property. It&#8217;s a little simpler &#8211; a little cleaner. Let&#8217;s use the same string (sItem):</p>
<blockquote><p>Response.write (sItem.IndexOf(&#8220;the&#8221;))</p></blockquote>
<p>Another variation of this would be more like the original <strong><em>instr</em></strong> function, it finds the position of a particular string, based on a starting location in that string.</p>
<blockquote><p>Response.write (sItem.IndexOf(&#8220;the&#8221;, 5))</p></blockquote>
<p>This would actually look for the position of the word &#8216;the&#8217;, but it would start looking at the 5th character position.</p>
<p>There are two new items we&#8217;ll look at now. They are &#8216;<em><strong>EndsWith</strong></em>&#8216; and &#8216;<strong><em>StartsWith</em></strong>&#8216;. I&#8217;ll only go into the explanation of &#8216;<em><strong>EndsWith</strong></em>&#8216;, because after that,  &#8216;<strong><em>StartsWith</em></strong>&#8216; will be self explanatory. The return value is a boolean in this case, and not a numeric position in the string. Let&#8217;s say <em>sItem</em>, in this case, is &#8216;We&#8217;re really having fun now!&#8221;. What these two properties do is check for certain strings or characters and, if the string ends with or starts with that character or string, the return is &#8216;True&#8217;. Otherwise, of course, the return is &#8216;False&#8217;. Here&#8217;s how you would use it:</p>
<blockquote><p>Response.Write (sItem.EndsWith(&#8220;!&#8221;))</p></blockquote>
<p>Naturally, in this case, it would return &#8216;True&#8217;.</p>
<p>One last thing we need to look at in this tutorial is the replacement for &#8216;<strong><em>Len</em></strong>&#8216;. In Classic ASP, we&#8217;d write:</p>
<blockquote><p>response.Write (len(sItem))</p></blockquote>
<p>In ASP.Net, it&#8217;s a little different &#8211; as before, each string is an &#8216;object&#8217;. Therefore, you assign the length property to it:</p>
<blockquote><p>response.Write (sItem.Length)</p></blockquote>
<blockquote><p>The Compare property is a pretty neat addition to ASP.Net and works in a a couple of different ways. In each case, lets go with the fact that <em>sFirstItem</em> is &#8220;Chevy&#8221; and <em>sSecondItem</em> is &#8220;Ford&#8221;.  Here&#8217;s the basic format in which you would see it used:</p>
<blockquote><p>String.Compare(sFirstItem, sSecondItem)</p></blockquote>
<p>This, of course, shows you the format using variables, which is more like what will be encountered in day to day programming. You could use exact strings also, with double-quotes around each item. However, since they are exact strings, In the Classic ASP days, we&#8217;d need to attack it something like this:</p>
<blockquote>
<pre>if sFirstItem=sSecondItem then
	response.Write ("It's a Match")
else
	response.Write ("It's Not a Match")
End If</pre>
</blockquote>
<p>It&#8217;s not really more compact in ASP.Net, but here&#8217;s the way it&#8217;s utilized:</p>
<blockquote>
<pre>if String.Compare(sFirstItem, sSecondItem) =0 then
	response.Write ("It's a Match")
else
	response.Write ("It's Not a Match")
End If</pre>
</blockquote>
<p>By default &#8211; this compare method is NOT case-sensitive. However, you have the option to &#8216;turn-on&#8217; case-sensitivity, if the requirements dictate such. To do so, you would add a third argument &#8220;True&#8221; to the comparison. The format of the first line would then be:</p>
<blockquote>
<pre>if String.Compare(sFirstItem, sSecondItem, True) =0 then</pre>
</blockquote>
<p>As before, the <strong><em>Trim</em></strong> function is still available. For those who don&#8217;t know about it, let&#8217;s say, when someone enters their password, they inadvertently typed in a space either before, or at the end of the password. Therefore, when the login occurred, technically, the password would not match, since the original password did not have the space in it. To get around this in Classic ASP, you would use the Trim Function like this:</p>
<blockquote><p>Response.Write (Trim(sPassword))</p></blockquote>
<p>In ASP.Net, the format is :</p>
<blockquote><p>response.Write (sPassword.Trim())</p></blockquote>
<p>This would take what was originally typed in as &#8221; ThisisMyPassword &#8221; and make it &#8220;ThisisMyPassword&#8221;Along with the Trim function, there is TrimStart and TrimEnd, which specifically trim from the  &#8211; <em>you guessed it</em> &#8211; start and end of the string. Each of the Trim functions also accept a character array as a parameter in order to remove characters other than basic white space from the strings.</p>
<p>Also, in Classic ASP days, we had the <strong><em>Replace</em></strong> Function. It&#8217;s still here in ASP.Net, but with a different formatting, as usual. Instead of using:</p>
<blockquote><p>sItem = Replace(sItem, &#8220;CharacterToBeReplaced&#8221;, &#8220;ReplacementCharacter&#8221;)</p></blockquote>
<p>We now use:</p>
<blockquote><p>sItem = sItem.Replace(&#8220;CharacterToBeReplaced&#8221;, &#8220;ReplacementCharacter&#8221;)</p></blockquote>
<p>Along with the <strong><em>Replace</em></strong> Function, there is now, also an <strong><em>Insert</em></strong> Function:</p>
<blockquote><p>sItem = sItem.Insert(10, &#8220;Wow &#8211; this is really cool!&#8221;)</p></blockquote>
<p>Here, we insert the string &#8220;Wow &#8211; this is really cool!&#8221;, 10 characters into the string.Again, as before, we had, and still have  the <strong><em>Split</em></strong> function, but now it&#8217;s formatted a little differently. The Split function takes a string and &#8217;splits&#8217; the string into sections, at certain intervals, based on a common separator between those characters, and puts the sections into an array. As a default, it defaults at any white space being the separator. So, if you had a string that was separated by a space or tab, etc, and just use :</p>
<blockquote><p>arrNewSplit = sString.Split()</p></blockquote>
<p>If it was a comma-delimited string, you would use:</p>
<blockquote><p>arrNewSplit = sString.Split(&#8220;,&#8221;)</p></blockquote>
<p>This pretty well wraps up what these tutorials are going to cover. By no means is this all ASP.Net does with strings, but what has been mentioned in the last two tutorials is, what we believe are some of the most common useages and the most helpful points of the String Class.</p></blockquote>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[String sınıfının genel özellikleri ve Kullanımları]]></title>
<link>http://trword.wordpress.com/2008/12/12/string-sinifinin-genel-ozellikleri-ve-kullanimlari/</link>
<pubDate>Fri, 12 Dec 2008 12:06:35 +0000</pubDate>
<dc:creator>mesut cakir</dc:creator>
<guid>http://trword.wordpress.com/2008/12/12/string-sinifinin-genel-ozellikleri-ve-kullanimlari/</guid>
<description><![CDATA[Chars  : Belirlenmiş bir karakterin yerine karakter ekler. Length : Stringdeki karakter sayısını ver]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><strong><span style="font-weight:normal;font-size:10pt;color:black;font-family:Verdana;">Chars  :</span></strong><span style="font-size:10pt;color:black;font-family:Verdana;"> Belirlenmiş bir karakterin yerine karakter ekler.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">Length :</span></strong> Stringdeki karakter sayısını verir.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">Compare</span></strong> : Belirlenmiş iki string nesnesini karakter sayılarına göre karşılaştırır.<br />
Sonuç eşit ise “0”, büyükse “+1”, küçükse”-1” değerlerini döndürür.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">CompareTo :</span></strong>  Belirlenen iki stringi alfabetik sıraya göre karşılaştır. Sonuç eşit ise “0”,<!--more--><br />
eşit değil ise “-1” değeri geri döndürür.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">Concat</span></strong> : Stringi bir veya birden fazla string ile birleştirir. <br />
<strong><span style="font-weight:normal;font-family:Verdana;">Contains</span></strong>  : String içerisinde belirlenmiş başka string nesnelerinin bulunup<br />
bulun madığını kontrol eder.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">Copy</span></strong> : Belirlenmiş bir string karakterlerini kullanarak yeni bir örnek string<br />
oluşturur.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">EndsWith :</span></strong>  Stringin sonunda belirli bir string örneğinin olup olmadığına karar verir.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">Equals :</span></strong>  İki string nesnesinin aynı değerlere sahip olup olmadığı kontrol eder. True<br />
veya false değerleri geri döndürür.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">Format</span></strong>  : Stringi bilgiyi belli bir biçime dönüştürür.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">GetEnumerator :</span></strong>  String içerisinde tekrar eden bir nesne bulur.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">GetHashCode</span></strong> : Stringdeki bozuk kodu bulur.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">GetType :</span></strong> Örneğin tipini verir.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">GetTypeCode</span></strong> :  Stringin  Type code (Tür kodunu) çağırır.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">IndexOf</span></strong>  : Stringin içindeki dizenin başlangıç noktasını bulur.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">IndexOfAny</span></strong>  : Stringdeki herhangi bir karakterin başlangıç noktasını bulur.<br />
I<strong><span style="font-weight:normal;font-family:Verdana;">nsert</span></strong>  : String içerisine karakter ekler.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">IsNullOrEmpty</span></strong> : Stringin boş olup olmadığını gösterir.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">LastIndexOf</span></strong>   : Bir karakter veya karakter grubunun stringin içinde bulunduğu pozisyonu<br />
sayısal olarak ifade eder. (Eğer karakter veya karakter grubu string<br />
içerisinde birden fazla ise en sondaki karakter veya karakter grubunun<br />
sayısal olarak bulunduğu yeri belirtir.)<br />
<strong><span style="font-weight:normal;font-family:Verdana;">PadLeft</span></strong> : Stringin solundan başlayarak stringin boyutu verilen değere eşit olana<br />
kadar istenilen karakter eklenir.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">PadRight :</span></strong> Stringin sağından başlayarak stringin boyutu verilen değere eşit olana<br />
kadar istenilen karakter eklenir.<br />
ReferenceEquals Belirlenmiş nesne örneklerinin referans türle aynı olup olmadığına karar<br />
verir.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">Remove</span></strong>  : String içerisinde belirli sayıda karakter siler.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">Replace</span></strong> :Stringin istediğimiz karakterlerini değiştirmek için kullanılır.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">StartsWith</span></strong> : Belirlenen bir dizenin stringin başlangıcı olup olmadığını bulur. Boolean<br />
tipte bir değer döndürür.<br />
Substring  Stringde belirtilen bir karakterden başlayarak sabit sayıda karakter<br />
döndürür.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">ToCharArray :</span></strong>  Stringi dizi karakterlerine çevirir.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">ToLower</span></strong>  :Stringdeki harfleri küçük harfe dönüştürür.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">ToString</span></strong> : Bilgileri string türüne dönüştürür.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">ToUpper</span></strong>  : Stringdeki harfleri büyük harfe dönüştürür.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">Trim</span></strong>  : Stringin başında ve sonundaki boşlukları veya belirtilen karakterleri<br />
kaldırır.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">TrimEnd</span></strong>  : Stringin sonundaki boşlukları veya belirtilen karakterleri kaldırır.<br />
<strong><span style="font-weight:normal;font-family:Verdana;">TrimStart</span></strong>  : Stringin başındaki boşlukları veya belirtilen karakterleri kaldırır.</span></p>
<p style="text-align:center;"><strong><span style="font-weight:normal;font-size:10pt;color:black;font-family:Verdana;">*—–KULLANIMI—-*</span></strong><span style="font-size:10pt;color:black;font-family:Verdana;"></span></p>
<p style="text-align:left;"><span style="font-size:10pt;color:black;font-family:Verdana;">1.  a.Length = 1. stringin karakter uzunluğunu verir. Uzunluk bulunurken boşluklar<br />
dâhil edilir.<br />
2.  b.Chars(1) = 2  . stringin 1. elemanını ekrana yazdırır. Dikkat edilecek husus<br />
stringin ilk karakteri  0. elemanıdır.<br />
3.  a.CompareTo(b) = 1  . string ile 2. stringi karşılaştırır. İki string eşit -1 değeri<br />
döndürür.<br />
4.  String.Concat(a, b) = 1 . stringin sonuna 2. stringi ekler. 1. stringin sonunda<br />
veya 2. stringin başında boşluk olmadığından stringler birleştirildiğinde arada<br />
boşluk olmaz.<br />
5.  a.Contains(”eslek”) = 1 .  string içerisinde “eslek” kelimesi olduğundan true<br />
değeri döndürür.<br />
6.  String.Copy(a) = 1. stringin kopyasını oluşturur.<br />
7.  a.IndexOf(”düstri”) = “dustri”  stringinin 1. stringin kaçıncı karakterinden<br />
itibaren başladığını gösterir. stringin ilk elemanı 0. karakterdir.<br />
8.  b.Insert(3, “v”) = 2.  stringin 3. karakterine v harfini ekler.<br />
9.  String.IsNullOrEmpty(b) = 2.  Stringin boş olup olmadığını kontrol eder. Boş<br />
olmadığı için False değeri döndürür.<br />
10.  a.LastIndexOf(”d”) = d harfinin 1. stringin kaçıncı karakteri olduğunu bulur.<br />
11.  a.PadLeft(30, “?”) = 1 . stringin sol tarafına toplam uzunluk 30 karakter olana<br />
kadar “?” işareti ekler.<br />
12.  b.PadRight(15, “*”) = 2  .  stringin sağ tarafına toplam uzunluğu 15 karakter<br />
olana kadar “*” işareti ekler.<br />
13.  a.Remove(3, 5) = 1 . stringin 3. karakterinden başlayarak 5 karakter siler.<br />
14.  b.ToUpper = 2 . stringin bütün karakterlerini büyük harfe çevirir.<br />
15.  a.ToLower = 1 . stringin bütün karakterlerini küçük harfe çevirir.<br />
16.  a.Trim(”En”) = 1 . stringin başında veya sonunda En kelimesi varsa bulup siler.<br />
17.  a.Replace(”Meslek”, “Teknik”) = 1  . string içerisinde “Meslek” kelimesini<br />
arayıp bulduğunda “Teknik” kelimesi ile yer değiştirir.</span></p>
<p class="MsoNormal" style="margin:0;"><!-- You can start editing here. --><span style="font-size:10pt;"><span style="font-family:Times New Roman;"> </span></span></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[PHP indexOf]]></title>
<link>http://dailypaste.wordpress.com/2008/10/26/php-indexof/</link>
<pubDate>Sun, 26 Oct 2008 09:32:19 +0000</pubDate>
<dc:creator>freecheese</dc:creator>
<guid>http://dailypaste.wordpress.com/2008/10/26/php-indexof/</guid>
<description><![CDATA[Php uses stripos $pos3 = stripos($pageURL , &#8216;-q-&#8217;) + 3 ;]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Php uses <a href="http://us3.php.net/manual/en/function.stripos.php">stripos</a></p>
<p>$pos3 = stripos($pageURL , &#8216;-q-&#8217;) + 3 ;</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[~, !, +, &amp; -]]></title>
<link>http://dreaminginjavascript.wordpress.com/2008/07/04/28/</link>
<pubDate>Fri, 04 Jul 2008 16:02:50 +0000</pubDate>
<dc:creator>Nosredna</dc:creator>
<guid>http://dreaminginjavascript.wordpress.com/2008/07/04/28/</guid>
<description><![CDATA[Does that headline look like a bunch of cussing to you? I was hoping it would be offensive. I&#8217;]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a href="http://dreaminginjavascript.files.wordpress.com/2008/07/georgecarlin-l4.jpg"><img class="alignleft size-medium wp-image-29" src="http://dreaminginjavascript.wordpress.com/files/2008/07/georgecarlin-l4.jpg?w=239" alt="" width="165" height="208" /></a><em><strong>Does that headline look like a bunch of cussing</strong></em> to you? I was hoping it would be offensive.</p>
<p>I&#8217;m also looking forward to see how it&#8217;s covered by the tech aggregators like Digg and Reddit. And I want to see if perhaps people land here as the result of searching for a bunch of punctuation.</p>
<p>Mostly I wanted to talk about JavaScript types, and how you can convert from boolean to numeric and vice versa.</p>
<p>This is going to be a pretty freeform discussion. If you get bored jump right to the end&#8211;there&#8217;s a trick there that&#8217;s pretty useful.</p>
<h3>Big Mistake. Big, Big Mistake</h3>
<p>Douglas Crockford has often mentioned that the dual usage for the plus symbol is a mistake in JavaScript. He&#8217;s right. It&#8217;s used both for numeric addition and for string concatenation. This trips programmers up all the time and there&#8217;s just no excuse for it. No upside. Another symbol should have been used for string concatenation.</p>
<p>The common solution to this is to wait until you get tripped up, find which term is being mistaken for a string, and then use one of the functions that JavaScript provides that converts strings to numbers. I prefer to use yet <em>another</em> usage of the plus symbol to do that work. I use the unary version of plus.</p>
<p>For example:</p>
<pre>num = 1 + +"2"; //num is assigned the value 3</pre>
<p>See the space between the plus signs? Yeah, that&#8217;s critical. You don&#8217;t want to mistake those two pluses for the symbol ++, the increment operator.</p>
<p>A unary minus works too, if you happen to want the negated version.</p>
<pre>num = 1 - -"2"; //num is assigned the value 3, again</pre>
<p>There&#8217;s another cool use for the plus sign. It&#8217;ll turn true and false into numbers.</p>
<pre>num=+true; // num is 1
num=+false; //num is 0
num=-true; // num is -1
num=-false; //num is 0</pre>
<p><a href="http://dreaminginjavascript.files.wordpress.com/2008/07/cher-photograph-c12142223.jpeg"><img class="alignright size-medium wp-image-32" src="http://dreaminginjavascript.wordpress.com/files/2008/07/cher-photograph-c12142223.jpeg?w=241" alt="" width="149" height="185" /></a>So we turn true and false into 1 and 0 with unary plus. How do we turn 1 and 0 into true and false? One way is with the bang (exclamation point). In this case, we actually use a double-bang or &#8220;bang bang.&#8221; (Google &#8220;bang bang cher&#8221; and find out that long before William Hung banged, Cher banged.)</p>
<pre>bool = !!1; //bool is true
bool = !!0; //bool is false</pre>
<p>The first bang casts from the number to a Boolean, and the second undoes the logical not that was performed by the first bang.</p>
<p>You still following? How about a curve ball?</p>
<pre>num = 1 + ~~"2"; //what the hell is that?</pre>
<p><a href="http://dreaminginjavascript.files.wordpress.com/2008/07/curveball.jpg"><img class="alignright size-medium wp-image-30" src="http://dreaminginjavascript.wordpress.com/files/2008/07/curveball.jpg?w=150" alt="" width="150" height="210" /></a>Welcome to the tilde. The result is 3 again, but what&#8217;s with the squiggles? The squiggle, of course, is the tilde operator. JavaScript programmers learn it and then promptly forget about it. But it plays a part in one of my favorite JavaScript tricks. We&#8217;ll see that right at the end. For now, let&#8217;s look at what it does to some values.</p>
<pre>console.log(~-2); //1
console.log(~-1); //0
console.log(~0); //-1
console.log(~1); //-2
console.log(~2); //-3
console.log(~true); //-2
console.log(~false); //-1</pre>
<p>As you can see, ~ is doing -(N+1). For fun, let&#8217;s throw a unary minus into the mix.</p>
<pre>console.log(-~-2); //-1
console.log(-~-1); //0
console.log(-~0); //1
console.log(-~1); //2
console.log(-~2); //3
console.log(-~true); //2
console.log(-~false); //1</pre>
<p>So -~N is the same as N+1.</p>
<p>Now let&#8217;s look at the bang symbol along with the tilde.</p>
<pre>console.log(!-2); //false
console.log(!-1); //false
console.log(!0); //true
console.log(!1); //false
console.log(!2); //false
console.log(!true); //false
console.log(!false); //true</pre>
<p>And for fun, let&#8217;s put the bang and the tilde together&#8230;</p>
<pre>console.log(!~-2); //false
console.log(!~-1); //true
console.log(!~0); //false
console.log(!~1); //false
console.log(!~2); //false
console.log(!~true); //false
console.log(!~false); //false</pre>
<p>Now that&#8217;s interesting. Only the value -1 makes it out alive with a <strong>true</strong> value. And come to think of it, there&#8217;s something special about -1. It&#8217;s a common sentinel value returned by functions that return indexes (JavaScript&#8217;s <strong>indexOf()</strong> is a great example, but you may have your own functions that return -1 as a sentinel value).</p>
<h3>WTF?</h3>
<p>What am I talking about? Suppose you want to know where the letter &#8220;s&#8221; is in a string. Well, you either get a number back that tells you where it is, or you get a -1 back telling you, hey buddy, no &#8220;s&#8221; in this string. So you end up with code like&#8230;</p>
<pre>if (index&#62;=0) {
 //found it
} else {
 //didn't
}</pre>
<p>or</p>
<pre>if (index&#62;-1) {
 //found it
} else {
 //didn't
}</pre>
<p>or</p>
<pre>if (index!=-1) {
 //found it
} else {
 //didn't
}</pre>
<p>But with what we now know about tilde, we can just do this&#8230;</p>
<pre>if (!~index) {
 //found it
} else {
 //didn't
}</pre>
<p>Or, finally, we can turn the logic around and do this&#8230;</p>
<pre>if (~index) {
 //didn't find it
} else {
 //did
}</pre>
<h3><a href="http://dreaminginjavascript.wordpress.com/files/2008/07/curse.jpg"><img class="alignright size-medium wp-image-33" src="http://dreaminginjavascript.wordpress.com/files/2008/07/curse.jpg?w=250" alt="" width="153" height="123" /></a></h3>
<h3>Credit</h3>
<p>I&#8217;ve seen this trick a few times before. Add a comment to this post if you can help me find other places this has been mentioned.</p>
<p><a title="Web Reflections" href="http://webreflection.blogspot.com/2008/06/two-simple-tricks-in-javascript-olds.html">Web Reflections</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Tips for Download MP3 on Google]]></title>
<link>http://meongkuru.wordpress.com/2008/03/19/tips-for-download-mp3-on-google/</link>
<pubDate>Wed, 19 Mar 2008 01:09:49 +0000</pubDate>
<dc:creator>meongkuru</dc:creator>
<guid>http://meongkuru.wordpress.com/2008/03/19/tips-for-download-mp3-on-google/</guid>
<description><![CDATA[This a simple way to find MP3 songs by Google Search. You need no such extra tools and application a]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>
This a simple way to find MP3 songs by Google Search. You need no such extra tools and application and membership. Simply googling with certain keyword. </p>
<p>This is the way:<br />
1.	Open Google.<br />
2.	Type this query in the search box ?intitle:index.of? mp3 [artist] [title]<br />
Change [artist] with artist/band name and  [title] with the songs title you look for. </p>
<p>Examples:</p>
<p>?intitle:index.of? mp3 coldplay<br />
?intitle:index.of? mp3 “simple plan”<br />
?intitle:index.of? mp3 “simple plan” untitled<br />
?intitle:index.of? mp3 “welcome to my life”</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Trabajando con cadenas [JAVA]]]></title>
<link>http://exequielc.wordpress.com/2008/01/26/trabajando-con-cadenas-java/</link>
<pubDate>Sat, 26 Jan 2008 22:44:11 +0000</pubDate>
<dc:creator>exequielc</dc:creator>
<guid>http://exequielc.wordpress.com/2008/01/26/trabajando-con-cadenas-java/</guid>
<description><![CDATA[Trabajando con cadena de caracteres Para obtener la longitud, número de caracteres que guarda un str]]></description>
<content:encoded><![CDATA[Trabajando con cadena de caracteres Para obtener la longitud, número de caracteres que guarda un str]]></content:encoded>
</item>
<item>
<title><![CDATA[_egugle_]]></title>
<link>http://eblogdepedro.wordpress.com/2008/01/26/_egugle_/</link>
<pubDate>Sat, 26 Jan 2008 01:07:54 +0000</pubDate>
<dc:creator>eblogdepedro</dc:creator>
<guid>http://eblogdepedro.wordpress.com/2008/01/26/_egugle_/</guid>
<description><![CDATA[Emule en Google&#8230; o algo por el estilo. Lo he visto por ahí y no sé seguro por dónde nos van a ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Emule en Google&#8230; o algo por el estilo. Lo he visto por ahí y no sé seguro por dónde nos van a llegar los tiros, pero de momento un &#8216;truco&#8217; o &#8216;way&#8217; para utilizar Google más eficazmente a la hora de realizar búsquedas de canciones.</p>
<p>Es cierto que si introducimos el nombre de un artista o canción en la barra de búsqueda de Google nos devuelve millones de resultados, letras, páginas publicitarias, webs oficiales, en fin, una cantidad asombrosa de resultados entre las cuales encontrar el archivo de audio o mp3 que buscamos es casi imposible. Ahora bien, hay otra forma. <a href="http://twitter.com/miki_soygik" target="_blank">Miki</a> nos habla de <a href="http://www.soygik.com/2008/01/24/%c2%bfbuscas-algun-archivo-mp3-en-internet/" target="_blank">cómo encontrar música en internet</a> pero anteriormente ya había explicado cómo podíamos <a href="http://www.soygik.com/2007/05/29/como-hackear-google-para-que-sea-una-red-p2p-musicavideosetc-1%c2%aa-parte/" target="_blank">jugar con Google para encontrar los archivos de música que queremos</a>.</p>
<p>Prosigo; introducimos en nuestra barra de Google la siguiente línea:</p>
<p align="center"><b>intitle:&#8221;index.of&#8221; (mp3&#124;mp4&#124;avi) titulo.de.la.cancion.separado.con.puntos</b></p>
<p> Nos aparecerá una lista de sitios bastante más reducida y en la que nos muestra los sitios que tienen ese archivo bien en <i>mp3</i>, <i>mp4</i> o <i>avi</i> que viene a ser lo que nos interesa. Bien, llegados a este punto puede que nos interese descargar el archivo de música en vez de escucharlo a través de los reproductores de los navegadores. Yo por ejemplo, para eso utilizo <a href="http://www.downloadhelper.net/manual.php" target="_blank">DownloadHelper</a> para el Mozilla Firefox que es el que uso. Con esta herramienta únicamente tenemos que seleccionar el archivo que queremos de todos los que identifica como multimedia que pueda haber en la página que estamos viendo y lo guarda en nuestro equipo a golpe de un par de clicks. Y así, sucesivamente.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Flash: Resume Texto (substring e indexOf)]]></title>
<link>http://rogeriolino.wordpress.com/2007/02/23/flash-resume-texto-substring-e-indexof/</link>
<pubDate>Fri, 23 Feb 2007 22:51:51 +0000</pubDate>
<dc:creator>Rogério Alencar Lino Filho</dc:creator>
<guid>http://rogeriolino.wordpress.com/2007/02/23/flash-resume-texto-substring-e-indexof/</guid>
<description><![CDATA[Esses dias no Forum FlashMasters um amigo meu deixou a seguinte dúvida: Ele queria saber como fazer ]]></description>
<content:encoded><![CDATA[Esses dias no Forum FlashMasters um amigo meu deixou a seguinte dúvida: Ele queria saber como fazer ]]></content:encoded>
</item>

</channel>
</rss>
