1
나는 문자열로 버퍼를 변환하려고하지만 분명히 내가이 공간을 제거하는 방법
을 제거하고dlang char []를 문자열로 변환하고 트리밍하는 방법은 무엇입니까?
string getClass(HWND hwnd=NULL){
char[100] str;
GetClassNameA(hwnd, str.ptr, str.length);
writeln(str.dup.strip,'"'); //nothing is stripped, str is printed as 100 characters
writeln(str[99]=='\0'); //false
writeln(str[99]==' '); //false
writeln(str.dup[99]=='\0'); //false
writeln(str.dup[99]==' '); //false
writeln(str.dup.strip[99]=='\0'); //false
writeln(str.dup.strip[99]==' '); //false
return to!string(str).strip; //same nothing is stripped
}
맞습니다. 감사합니다. GetClassName이 길이를 반환한다는 것은 행운입니다. – shuji
행운을 불어 넣지 마세요, 그게 정확히 같은 용도로 디자인 된 것입니다. –
그렇지 않은 경우, 0 종결 자 ('strlen' 함수)의 문자열을 스캔하여 해당 btw로 슬라이스 할 수도 있습니다. –