[][src]Function voca_rs::manipulate::word_wrap

pub fn word_wrap(
    subject: &str,
    width: usize,
    newline: &str,
    indent: &str
) -> String

Wraps subject to a given number of characters using a string break character.

Arguments

  • subject - The string to wrap.
  • width - The number of characters at which to wrap.
  • newline - The string to add at the end of line. Default value is "\n" (if it's not given).
  • indent - The string to intend the line. Default value is "" (if it's not given).

Example

use voca_rs::*;
manipulate::word_wrap("Hello world", 5, "", "");
// => "Hello\nworld"
manipulate::word_wrap("Hello world", 5, "<br/>", "__");
// => "__Hello<br/>__world"
use voca_rs::Voca;
"Hello world"._word_wrap(5, "", "");
// => "Hello\nworld"