[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 219
  • Last Modified:

Get first character in a string...

I need a function that will pull the first character in a string.

Is this a one liner?

Thanks,
0
Weller0123
Asked:
Weller0123
  • 2
2 Solutions
 
allanau20Commented:
Dim str as string = "abcdeft"
Dim s as string = str.Substring(1,1)

s will give u 'a'
0
 
allanau20Commented:
Opps. it should be str.Substring(0,1)
0
 
vladimir_kalashnikovCommented:
or you could just use:

string str = "abcdefg";

char s = str[0];
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now