How to take a first character from the string
Using VB.Net & SQ开发者_JS百科L Server 2005
Dim S as string
s = "Rajan"
s = "Sajan"
I want to take a first character from the string (s)
Expected Output
R
S
Need VB.Net Code Help
Try this..
Dim S As String
S = "RAJAN"
Dim answer As Char
answer = S.Substring(0, 1)
Try this:
Dim s = "RAJAN"
Dim firstChar = s(0)
You can even do this:
Dim firstChar = "RAJAN"(0)
Use chars:
Dim firstChar As char;
firstChar = s.Chars(0);
http://vb.net-informations.com/string/vb.net_String_Chars.htm
"ABCDEFG".First
returns "A"
Dim s as string
s = "Rajan"
s.First
'R
s = "Sajan"
s.First
'S
精彩评论