Solved

How to determine if the "L" character is the string?

Posted on 2016-09-28
3
40 Views
Last Modified: 2016-09-28
In my vb.net program, I just need to know if there is an "L" in the string--or not.
0
Comment
Question by:sasllc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 77

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 50 total points
ID: 41820959
Most languages have an INSTR function.

VB is one of them:
https://msdn.microsoft.com/en-us/library/8460tsh1(v=vs.90).aspx
0
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 300 total points
ID: 41820964
Try the Contains method something like this.

Dim s = "the string has a L in it"
If s.Contains("L") Then
    '' it has an L
End If
0
 
LVL 51

Assisted Solution

by:Ryan Chong
Ryan Chong earned 150 total points
ID: 41820965
or try use IndexOf function:
Dim Str As String = "Hello World"
        Dim isFound As Boolean = (Str.IndexOf("L") > 0)
        MessageBox.Show("isFound = " + isFound.ToString())

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question