Skip to content

Latest commit

 

History

History
71 lines (38 loc) · 1.32 KB

trim.md

File metadata and controls

71 lines (38 loc) · 1.32 KB

Ancillary Module Reference: trim

Trim strings.

How to use

Make rules available in your current module.

import trim ;

Trim a string.


test-str = "    hello world     " ;

left-trimed  = [ trim.left $(test-str) ] ;
right-trimed = [ trim.left $(test-str) ] ;
fully-trimed = [ trim.trim $(test-str) ] ;

Trim a shell cmd.

trimmed-result = [ trim.sh $(SHELL-CMD) ] ;

rules

  • rule trim-left-regex ( )

    Return regex pattern that matches all but left whitespace.

  • rule trim-right-regex ( )

    Return regex pattern that matches all but the right whitespace.

  • rule trim-regex ( )

    Return regex pattern that matches all but the left and right whitespace.

  • rule left ( strs * )

    Return strs with left most whitespace removed from each item.

  • rule right ( strs * )

    Return strs with right most whitespace removed from each item.

  • rule trim ( strs * )

    Return strs with left and right whitespace removed from each item.

  • rule sh ( command : * )

    Just like Boost.Build's SHELL only left and right whitespace removed from the result.

Test examples

In the unit-test rule test in source:

trim.jam