691 B
691 B
String::CStr
const char* CStr() const;
返回指向以 null 结尾的 C 字符串的指针。
参数: 无
返回: 指向内部字符数组的指针,以 null 结尾
复杂度: O(1)
示例:
#include "XCEngine/Core/Containers/String.h"
#include <iostream>
#include <cstring>
int main() {
XCEngine::Containers::String s("Hello World");
const char* cstr = s.CStr();
std::cout << cstr << std::endl; // 输出: Hello World
std::cout << "Length: " << std::strlen(cstr) << std::endl; // 输出: Length: 11
return 0;
}