0

Simple Question.

How to check what char is on first Position on a LPCSTR?

Or just check if there is a Space on first Position?

Jens Krüger
  • 263
  • 1
  • 3
  • 18

1 Answers1

1

Given an LPCSTR named str, you can access the first character using str[0]. For example:

if (str[0] == ' ') {
    // First character is a space
}
cdhowie
  • 158,093
  • 24
  • 286
  • 300
  • 1
    @JensKrüger Yes, `*a` and `a[0]` are equivalent expressions (when not considering operator overloading). – cdhowie Dec 11 '14 at 15:52