{"id":416,"date":"2014-10-09T13:02:14","date_gmt":"2014-10-09T13:02:14","guid":{"rendered":"http:\/\/mairwa.com\/wordpress\/?p=416"},"modified":"2014-10-09T13:02:14","modified_gmt":"2014-10-09T13:02:14","slug":"code-for-reverse-string","status":"publish","type":"post","link":"http:\/\/mairwa.com\/wordpress\/?p=416","title":{"rendered":"code for reverse string in c# and find duplicate record in jquery"},"content":{"rendered":"<p>static string reverse(string ss)<\/p>\n<p>{<\/p>\n<p>string[] strArray = ss.Split(&#8216; &#8216;) ;<\/p>\n<p>string revs=&#8221;&#8221;;<\/p>\n<p>\/\/int i = strArray.Length;<\/p>\n<p>StringBuilder sb = new StringBuilder();<\/p>\n<p>for (int i = 0; i &lt; strArray.Length; i++)<\/p>\n<p>&nbsp;<\/p>\n<p>{<\/p>\n<p>string ty = string.Join(&#8220;&#8221;,strArray[i].Reverse().ToArray());<\/p>\n<p>\/\/\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 string firstLetter = strArray[i].Substring(0, 1);<\/p>\n<p>string firstLetter = ty.Substring(0, 1);<\/p>\n<p>\/\/string secondPart = strArray[i].Substring(strArray[i].Length -2 ,0);<\/p>\n<p>string secondPart = ty.Substring(1);<\/p>\n<p>&nbsp;<\/p>\n<p>sb.Append(firstLetter.ToUpper() + secondPart + &#8221; &#8220;);<\/p>\n<p>&nbsp;<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\/\/ return sb.ToString().Remove(sb.Length &#8211; 1);<\/p>\n<p>&nbsp;<\/p>\n<p>for (int i1 = 0; i1 &lt; strArray.Length ; i1++)<\/p>\n<p>{<\/p>\n<p>string spstring = strArray[i1];<\/p>\n<p>int i = spstring.Length;<\/p>\n<p>string revs1 = &#8220;&#8221;;<\/p>\n<p>for (int j = i; j &gt; 0; j&#8211;)<\/p>\n<p>{<\/p>\n<p>revs1 = revs1 + spstring[j &#8211; 1];<\/p>\n<p>sb.Append(spstring[j &#8211; 1]).ToString();<\/p>\n<p>if (j == i)<\/p>\n<p>\/\/if(i==1)<\/p>\n<p>{<\/p>\n<p>\/\/string s=sb.ToString().ToUpper();<\/p>\n<p>string s = spstring[j &#8211; 1].ToString().ToUpper();<\/p>\n<p>sb.Remove(sb.Length &#8211; 1, 1);<\/p>\n<p>sb.Append(s).ToString();<\/p>\n<p>\/\/ sb.Replace(spstring[j &#8211; 1].ToString(), spstring[j &#8211; 1].ToString().ToUpper());<\/p>\n<p>\/\/sb[j &#8211; 1] = Char.ToUpper(sb[j &#8211; 1]);<\/p>\n<p>revs1 = spstring[j &#8211; 1].ToString().ToUpper();<\/p>\n<p>&nbsp;<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p>}<\/p>\n<p>\/\/sb.Append(spstring[j &#8211; 1]).ToString();<\/p>\n<p>revs =\u00a0 revs+&#8221; &#8220;+revs1 ;<\/p>\n<p>sb.Append(&#8221; &#8220;).ToString();<\/p>\n<p>}<\/p>\n<p>return revs;<\/p>\n<p>&nbsp;<\/p>\n<p>}<\/p>\n<p><strong>&#8212;&#8212;&#8212;&#8212;-Duplicate value find and remove in jquery&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/strong><\/p>\n<p>var myArr = new Array(5);<br \/>\nmyArr[0] = &#8220;a&#8221;;<br \/>\nmyArr[1] = &#8220;d&#8221;;<br \/>\nmyArr[2] = &#8220;b&#8221;;<br \/>\nmyArr[3] = &#8220;c&#8221;;<br \/>\nmyArr[4] = &#8220;b&#8221;;<br \/>\nvar kk = myArr.sort().toArray();<br \/>\n\/\/var tt=$.sort(myArr).ToArray();<br \/>\nfunction getNum(aVal) {<br \/>\nnum = 0;<br \/>\nfor (i = 0; i &lt;= myArr.length; i++) {<br \/>\nif (myArr[i] == aVal)<br \/>\nnum++;<br \/>\n}<br \/>\njQuery.each(myArr, function (index, val) {<br \/>\nif (val == aVal)<br \/>\nnum++;<br \/>\n});<br \/>\n\/\/jQuery myArr.each(function(index, val) {<br \/>\n\/\/ if (val == aVal)<br \/>\n\/\/ num++;<br \/>\n\/\/});<br \/>\nreturn num;<br \/>\n}<br \/>\nfunction getNum1() {<br \/>\nnum = 0;<br \/>\nfor (i = 0; i &lt;= kk.length; i++) {<br \/>\nif (i &gt; 0) {<br \/>\nif (kk[i] == kk[i &#8211; 1]) {<br \/>\nalert(kk[i]);<br \/>\nkk.remove(kk[i]);<br \/>\nnum++;<br \/>\n}<br \/>\n}<br \/>\n}<br \/>\nreturn num;<br \/>\n}<\/p>\n<p>getNum1();<br \/>\nalert(kk[1]);<br \/>\nalert(getNum(&#8216;b&#8217;));<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p class=\"excerpt\">static string reverse(string ss) { string[] strArray = ss.Split(&#8216; &#8216;) ; string revs=&#8221;&#8221;; \/\/int i = strArray.Length; StringBuilder sb = new StringBuilder(); for (int i = 0; i &lt; strArray.Length; i++) &nbsp; { string ty = string.Join(&#8220;&#8221;,strArray[i].Reverse().ToArray()); \/\/\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 string firstLetter = strArray[i].Substring(0, 1); string firstLetter = ty.Substring(0, 1); \/\/string secondPart = strArray[i].Substring(strArray[i].Length -2 ,0); string secondPart = ty.Substring(1); &nbsp; sb.Append(firstLetter.ToUpper()&hellip; <a href=\"http:\/\/mairwa.com\/wordpress\/?p=416\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,7,11],"tags":[],"class_list":["post-416","post","type-post","status-publish","format-standard","hentry","category-c-vb","category-c","category-oop","xfolkentry"],"_links":{"self":[{"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/416","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=416"}],"version-history":[{"count":0,"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/416\/revisions"}],"wp:attachment":[{"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=416"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}