I'm trying to create a program that determines if what i inputted is a Literal (String or a Char)
My idea on how to create one is if i inputted a string (Starts with the usual ") so the first Index in my Array should be " or else it will show invalid same with the last index it should be ".

So my problem is i don't know how. If i input something in a Textbox (Example: Daniweb) my program should automatical determine that an Array has 6 indexes, Can someone help me.

Use substr() method e.g. if textBox1.Text.Substring(0,1) = '"' then

Thanks for replying but i have one problem, It's not dynamic.
What if i type something that has larger numbers and letters and the one in the code is fixed it will give me Invalid.

Use the Textbox1.Text.Length property.

Any string is basically a character array. You can read the individual characters with an index, Textbox1.Text(0). The last character, without using LINQ, like this, Textbox1.Text(TextBox1.Text.Length-1). With LINQ, TextBox1.Text.Last().

A simple conditional statement to test, If Not(TextBox1.Text(0) = """"c) Or Not(TextBox1.Text(TextBox1.Text.Length-1) = """"c) Then.

Thank you every much.
I was so fixed on using something more complicated like what i've suggested with the indexes and arrays
whereas i didn't even know there's a Property like that, I really need to read more.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.