how to get first three character from string in asp.net?
for Example, From Hardik i want only Har from this
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sanjeeb LenkaPosted Aug 30, 2013, 8:17 AM
try this:
string s = "Hardik";
string result = s.Substring(0, 3);//get three character
Response.Write(result);// write the result in page
Nitesh KejriwalPosted Aug 30, 2013, 8:22 AM
Prasenjit DeyPosted Aug 30, 2013, 8:19 AM
string str = "Hardik";
str = str.Substring(0,3); //For filter 3 characters
Response.Write(str); // print that output
Use this code
Hope it will work