MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / SplitAt

Function SplitAt

tensorflow/core/framework/op_gen_lib.cc:86–98  ·  view source on GitHub ↗

Split `*orig` into two pieces at the first occurrence of `split_ch`. Returns whether `split_ch` was found. Afterwards, `*before_split` contains the maximum prefix of the input `*orig` that doesn't contain `split_ch`, and `*orig` contains everything after the first `split_ch`.

Source from the content-addressed store, hash-verified

84// contain `split_ch`, and `*orig` contains everything after the
85// first `split_ch`.
86static bool SplitAt(char split_ch, StringPiece* orig,
87 StringPiece* before_split) {
88 auto pos = orig->find(split_ch);
89 if (pos == StringPiece::npos) {
90 *before_split = *orig;
91 *orig = StringPiece();
92 return false;
93 } else {
94 *before_split = orig->substr(0, pos);
95 orig->remove_prefix(pos + 1);
96 return true;
97 }
98}
99
100// Does this line start with "<spaces><field>:" where "<field>" is
101// in multi_line_fields? Sets *colon_pos to the position of the colon.

Callers 4

StartsWithFieldNameFunction · 0.85
ConvertLineFunction · 0.85
PBTxtToMultilineFunction · 0.85
PBTxtFromMultilineFunction · 0.85

Calls 1

findMethod · 0.45

Tested by

no test coverage detected