char& charAt() - JanKulbaga/String-CPP GitHub Wiki

char& charAt()

Returns a reference to the character at position index in the string.

Example

#include <ostream>
#include "src/String.h"

int main()
{
    String s = "Hello World";
    char& c = s.charAt(0);
    std::cout << c;
    return 0;
}

Output:

H

Parameters

size_t index

Return value

The character at the specified position in the string.

⚠️ **GitHub.com Fallback** ⚠️