ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Ignore Alphanumeric words and Capitalize First letter of other words in string using C# and VB.Net<p>Hey <a class="username" rel="satabeach">satabeach</a>,</p> <p>Please refer below sample.</p> <p><span style="text-decoration: underline;"><strong>Namespaces</strong></span></p> <p><strong>C#</strong></p> <pre class="brush: csharp">using System.Globalization;</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">Imports System.Globalization</pre> <p><span style="text-decoration: underline;"><strong>Code</strong></span></p> <p><strong>C#</strong></p> <pre class="brush: csharp">protected void Page_Load(object sender, EventArgs e) { string message = &#34;&#34;; CultureInfo cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture; TextInfo textInfo = cultureInfo.TextInfo; string s = &#34;Petrol 10lt Iv Set inj.panadol 10mg&#34;; s = textInfo.ToTitleCase(s); string[] splitstring = s.Split(&#39; &#39;); bool first = true; foreach (var item in splitstring) { if (item.Any(char.IsLetter) &amp;&amp; item.Any(char.IsDigit)) { message += textInfo.ToLower(item) + &#34; &#34;; } else if (first) { message += textInfo.ToTitleCase(item + &#34; &#34;); first = false; } else { message += item + &#34; &#34;; } } Response.Write(message); }</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load Dim message As String = &#34;&#34; Dim cultureInfo As CultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture Dim textInfo As TextInfo = cultureInfo.TextInfo Dim s As String = &#34;Petrol 10lt Iv Set inj.panadol 10mg&#34; s = textInfo.ToTitleCase(s) Dim splitstring As String() = s.Split(&#34; &#34;c) Dim first As Boolean = True For Each item In splitstring If item.Any(AddressOf Char.IsLetter) AndAlso item.Any(AddressOf Char.IsDigit) Then message += textInfo.ToLower(item) &amp; &#34; &#34; ElseIf first Then message += textInfo.ToTitleCase(item &amp; &#34; &#34;) first = False Else message += item &amp; &#34; &#34; End If Next Response.Write(message) End Sub</pre> <p><span style="text-decoration: underline;"><strong>Output</strong></span></p> <p>Petrol 10lt Iv Set Inj.Panadol 10mg</p> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/108577/Ignore-Alphanumeric-words-and-Capitalize-First-letter-of-other-words-in-string-using-C-and-VBNet/https://www.aspforums.net:443/Threads/108577/Ignore-Alphanumeric-words-and-Capitalize-First-letter-of-other-words-in-string-using-C-and-VBNet/Wed, 05 Dec 2018 03:45:51 GMT