problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
leetcode::divide_a_string_into_groups_of_size_k::Solution类 参考

#include <leetcode.h>

静态 Public 成员函数

static vector< string > divideString (const string &s, int k, char fill)
 

详细描述

在文件 leetcode.h474 行定义.

成员函数说明

◆ divideString()

vector< string > leetcode::divide_a_string_into_groups_of_size_k::Solution::divideString ( const string &  s,
int  k,
char  fill 
)
static

在文件 leetcode.cpp1049 行定义.

1049 {
1050 auto ans = vector<string>();
1051 int i = 0;
1052 for(; i * k + k < s.length(); i++) {
1053 ans.push_back(s.substr(i * k, k));
1054 }
1055 if(i * k != s.length()) {
1056 string last = s.substr(i * k);
1057 for(int j = last.length(); j < k; j++) {
1058 last += fill;
1059 }
1060 ans.push_back(last);
1061 }
1062 return ans;
1063 }

被这些函数引用 leetcode::divide_a_string_into_groups_of_size_k::TEST().


该类的文档由以下文件生成: