コード例 #1
0
ファイル: transformers.cpp プロジェクト: Jstd/Jstd-Bootstrap
std::wstring& Remove_All_Chars_From_Back_Until_Char_Is_Seen(std::wstring & str, char const& c){
    bool seen = false;
    while(1){
        if (str.empty()){
            break;
        }else{
            if(Last_Char(str) == c){
                break;
            }else{
                Remove_Last_Char(str);
            }
        }
    }
    return str;
}
コード例 #2
0
std::vector<std::string> Read_Each_Line_Of_File_Into_Vector(std::string const& file){
	std::ifstream infile(file);
	std::string line;
	std::vector<std::string> lines;
	std::getline(infile, line);
	while (infile){
		lines.push_back(line);
		std::getline(infile, line);
	}
	infile.close();
	auto all = Read_Entire_File_Into_String(file);
	if (Last_Char(all) == '\n'){
		lines.emplace_back();
	}

	return lines;
}