Results 1 to 4 of 4
Threaded View
-
16th Jun 2010, 10:31 PM #1OPლ(ಠ益ಠლ)Website's:
extremecoderz.com[c#] Get String In between strings
This static string will obtain a string in between 2 strings.
For example. I have the string:
Code:<a href="myfile.php">foo-bar</a>
Code:result = GetStringInbetween("\">", "</a>", sourceFile, false, false); string myString = result[0];
Code:string[] result; public static string[] GetStringInBetween(string strBegin, string strEnd, string strSource, bool includeBegin, bool includeEnd) { string[] result = { "", "" }; int iIndexOfBegin = strSource.IndexOf(strBegin); if (iIndexOfBegin != -1) { if (includeBegin) { iIndexOfBegin -= strBegin.Length; } strSource = strSource.Substring(iIndexOfBegin + strBegin.Length); int iEnd = strSource.IndexOf(strEnd); if (iEnd != -1) { if (includeEnd) { iEnd += strEnd.Length; } result[0] = strSource.Substring(0, iEnd); if (iEnd + strEnd.Length < strSource.Length) { result[1] = strSource.Substring(iEnd + strEnd.Length); } } } else { result[1] = strSource; } return result; }
jayfella Reviewed by jayfella on . [c#] Get String In between strings This static string will obtain a string in between 2 strings. For example. I have the string: <a href="myfile.php">foo-bar</a> If i wanted to get the name of the link (foo-bar): result = GetStringInbetween("\">", "</a>", sourceFile, false, false); Rating: 5
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
C++ string search help needed
By googleplus in forum Web Development AreaReplies: 0Last Post: 12th May 2012, 04:42 PM -
php string - heredoc syntax
By desiboy in forum Web Development AreaReplies: 3Last Post: 16th Nov 2010, 05:15 PM -
Extracting data from a string
By pankaj in forum Web Development AreaReplies: 38Last Post: 6th Jul 2010, 01:38 PM -
Review Warez Strings!
By InnoX in forum Site ReviewsReplies: 4Last Post: 18th Jun 2010, 10:18 PM -
[Shared] [Gigapulse] Free Hosting(no strings attached)... Just try Us and you'll love us...
By ragavbpl1 in forum ArchiveReplies: 13Last Post: 28th Oct 2009, 05:06 AM
themaLeecher - leech and manage...
Version 5.03 released. Open older version (or...