newline.h

./lib/include/fn/newline.h · 287 B

From the archive h7v3.0a.tar.gz

Download the archive   « Back to the archive contents

#ifndef NEWLINE_H
#define NEWLINE_H

string add_newline(string str) {
  string lchar;

  if(!str) return "\n";
  lchar = extract(str,strlen(str)-1);
  return (lchar == "!" || lchar == "." || lchar == "?")
     ? str + "\n"
     : (lchar == "\n")
     ? str
     : str + ".\n";
}

#endif

Site Stats

Snippets: 1791
Codebases: 571