README.md (3120B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2018 The Stdlib Authors. 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 19 --> 20 21 # startcase 22 23 > Capitalize the first letter of each word in a string. 24 25 <section class="intro"> 26 27 </section> 28 29 <!-- /.intro --> 30 31 <section class="usage"> 32 33 ## Usage 34 35 ```javascript 36 var startcase = require( '@stdlib/string/startcase' ); 37 ``` 38 39 #### startcase( str ) 40 41 Capitalizes the first letter of each word in a `string`. 42 43 ```javascript 44 var str = startcase( 'beep boop a foo bar' ); 45 // returns 'Beep Boop A Foo Bar' 46 ``` 47 48 </section> 49 50 <!-- /.usage --> 51 52 <section class="examples"> 53 54 ## Examples 55 56 <!-- eslint no-undef: "error" --> 57 58 ```javascript 59 var startcase = require( '@stdlib/string/startcase' ); 60 61 var str = startcase( 'beep boop foo bar' ); 62 // returns 'Beep Boop Foo Bar' 63 64 str = startcase( 'Beep' ); 65 // returns 'Beep' 66 67 str = startcase( 'BeEp' ); 68 // returns 'BeEp' 69 70 str = startcase( '$**_beep_BoOp_**$' ); 71 // returns '$**_beep_BoOp_**$' 72 73 str = startcase( '' ); 74 // returns '' 75 ``` 76 77 </section> 78 79 <!-- /.examples --> 80 81 * * * 82 83 <section class="cli"> 84 85 ## CLI 86 87 <section class="usage"> 88 89 ### Usage 90 91 ```text 92 Usage: startcase [options] [<string>] 93 94 Options: 95 96 -h, --help Print this message. 97 -V, --version Print the package version. 98 ``` 99 100 </section> 101 102 <!-- /.usage --> 103 104 <section class="examples"> 105 106 ### Examples 107 108 ```bash 109 $ startcase 'beep boop foo bar' 110 Beep Boop Foo Bar 111 ``` 112 113 To use as a [standard stream][standard-streams], 114 115 ```bash 116 $ echo -n 'beep boop foo bar' | startcase 117 Beep Boop Foo Bar 118 ``` 119 120 </section> 121 122 <!-- /.examples --> 123 124 </section> 125 126 <!-- /.cli --> 127 128 <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> 129 130 <section class="related"> 131 132 * * * 133 134 ## See Also 135 136 - <span class="package-name">[`@stdlib/string/lowercase`][@stdlib/string/lowercase]</span><span class="delimiter">: </span><span class="description">convert a string to lowercase.</span> 137 - <span class="package-name">[`@stdlib/string/uppercase`][@stdlib/string/uppercase]</span><span class="delimiter">: </span><span class="description">convert a string to uppercase.</span> 138 139 </section> 140 141 <!-- /.related --> 142 143 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 144 145 <section class="links"> 146 147 [standard-streams]: https://en.wikipedia.org/wiki/Standard_streams 148 149 <!-- <related-links> --> 150 151 [@stdlib/string/lowercase]: https://github.com/stdlib-js/string/tree/main/lowercase 152 153 [@stdlib/string/uppercase]: https://github.com/stdlib-js/string/tree/main/uppercase 154 155 <!-- </related-links> --> 156 157 </section> 158 159 <!-- /.links -->