## IV. API Reference

[ Previous: C. Language-Behavior Functions | Next: E. Root-Class Functions ]

### D. Content-Trimming Functions

void BBCode::SetPreTrim ( string $`how` )
This function controls how NBBC removes whitespace from the start of the document. The default behavior is to remove no whitespace; however, it can be convenient to have NBBC remove any initial spaces or newlines for you. You supply a whitespace-removal string in $`how` using the same syntax as in the whitespace-removal parameters for a rule.
Parameters:

- how: This string describes what kinds of whitespace to remove. It is a simple pattern expression, constructed from the following elements:
  - `s` Remove any non-newline whitespace found.
  - `n` Remove a single newline, if one exists.
  - `a` Remove as many spaces and newlines as are found.
  The pattern provided is matched forward from the start of the input. The default is the empty string, which means no whitespace or newlines are to be removed.

Return Value: None.
Common Examples:
`'s'` Remove all non-newline whitespace
`'sn'` Remove all non-newline whitespace, then a single newline if it exists.
`'ns'` Remove a single newline if it exists, then all non-newline whitespace.
`'sns'` Remove all non-newline whitespace, then a single newline if it exists,
then any non-newline whitespace found past that newline.
string BBCode::GetPreTrim ( )
This function returns the current whitespace pre-trimming pattern. See SetPreTrim() for more details.
Return values: The current whitespace pre-trimming pattern.
void BBCode::SetPostTrim ( string $`how` )
This function controls how NBBC removes whitespace from the end of the document. The default behavior is to remove no whitespace; however, it can be convenient to have NBBC remove any trailing spaces or newlines for you. You supply a whitespace-removal string in $`how` using the same syntax as in the whitespace-removal parameters for a rule.
Parameters:

- how: This string describes what kinds of whitespace to remove. It is a simple pattern expression, constructed from the following elements:
  - `s` Remove any non-newline whitespace found.
  - `n` Remove a single newline, if one exists.
  - `a` Remove as many spaces and newlines as are found.
  The pattern provided is matched backward from the very end of the input. The default is the empty string, which means no whitespace or newlines are to be removed.

Return Value: None.
Common Examples:
`'s'` Remove all non-newline whitespace
`'sn'` Remove all non-newline whitespace, then a single newline if it exists.
`'ns'` Remove a single newline if it exists, then all non-newline whitespace.
`'sns'` Remove all non-newline whitespace, then a single newline if it exists,
then any non-newline whitespace found past that newline.
string BBCode::GetPostTrim ( )
This function returns the current whitespace post-trimming pattern. See SetPostTrim() for more details.
Return values: The current whitespace post-trimming pattern.

[ Previous: C. Language-Behavior Functions | Next: E. Root-Class Functions ]

Copyright © 2010, the Phantom Inker. All rights reserved.