Skip to content

halil/bower-stringbuilder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StringBuilder

![Gitter](https://badges.gitter.im/Join Chat.svg)

Simple pure Javascript string builder library.

Installing String Builder

You can install this package locally either with bower.

bower

# To get the latest stable version, use bower from the command line.
bower install stringbuilder

# To get the most recent, last committed-to-master version use:
bower install 'stringbuilder#master'

# To save the bower settings for future use:
bower install stringbuilder --save

# Later, you can use easily update with:
bower update

Using the String Builder Library

Simply include the scripts in your main HTML file, shown in the example below.

html

<script src="/bower_components/stringbuilder/stringbuilder.js"></script>

or

<script src="/bower_components/stringbuilder/stringbuilder.min.js"></script>

script

var sb = new StringBuilder();

sb.append("normal text ");

sb.appendLine();

sb.appendFormat("formatted text {0},{1}", "format 1", "format 2");

console.log(sb.toString());

/*
console =>
normal text
formatted text format 1,format 2
*/

API Docs

append method
var sb = new StringBuilder();
sb.append("text");
appendLine method
var sb = new StringBuilder();
sb.appendLine();
appendFormat method
var sb = new StringBuilder();
sb.appendFormat("text {0},{1}", "format 1", "format 2");
clear method
var sb = new StringBuilder();
sb.clear();
toString method
var sb = new StringBuilder();
sb.toString();

Browser Support

IE Chrome Firefox Opera Safari

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request

License

The MIT License (MIT)

Copyright © 2016 Halil İbrahim ŞAFAK

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Simple pure Javascript string builder library

Resources

License

Stars

Watchers

Forks

Packages

No packages published