Developing Feather-Weight Webservices with JavaScript

Extending the native String() class

You can see parts of this class in use in Configurable greeking and Using JS code libraries, part 2.

  Code from "Developing Featherweight Web Services with JavaScript"
  (c)An Elektrum Press, retain this notice

// extend String objects to do ucFirst() like Perl
String.prototype.ucFirst = function () {
  return this.substr(0,1).toUpperCase() +

// extend String objects to do reverse()
String.prototype.reverse = function () {
  var tmp = this.split('');
  return tmp.join('');

// snip whitespace off front and back of string
String.prototype.snip = function () {
  return this.replace(/^\s+|\s+$/g, '');

Live tests

« Extending the native Date() class · Extending the native Array() class »
Web Developing Featherweight Web Services with JavaScript
This is version 0.57b of this manual. It is a beta version with some gaps. We are grateful for feedback.

The code is the manual has not yet been fully tested against Internet Explorer. Bug reports are welcome.
An Elektrum Press Online