c++charcomparelpcstr

LPCSTR- How to check if first Position is a Space " "


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?


Solution

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

    if (str[0] == ' ') {
        // First character is a space
    }