[Solved] How can I get the first character of a string? [duplicate]


Use the index of the character you want, so:
a[0]

For a complete answer:

char getFirstChar(string inString, char defaultChar)
{
    if (string.IsNullOrEmpty(inString)) return defaultChar;
    return inString[0];
}

1

solved How can I get the first character of a string? [duplicate]