## String RubyNice version to add methods directly to the class by monkey patching * [String](#String) * [.toDownCase()](#String+toDownCase) → string * [.toUpCase()](#String+toUpCase) → string * [.getFirst()](#String+getFirst) → string * [.getLast()](#String+getLast) → string * [.getSample()](#String+getSample) → Object * [.scan(pattern)](#String+scan) ### string.toDownCase() → string Convert all characters inside the string into lower case **Example** ```js 'this-isAnExample_string'.downcase() // => 'this-isanexample_string' ``` ### string.toUpCase() → string Convert all characters inside the string into upper case **Example** ```js 'this-isAnExample_string'.upcase() // => 'THIS-ISANEXAMPLE_STRING' ``` ### string.getFirst() → string Get first character of the current string **Example** ```js 'Happy'.getFirst() // => 'H' ``` ### string.getLast() → string Get last character of the current string **Example** ```js 'Happy'.getLast() // => 'y' ``` ### string.getSample() → Object Returns a random element of the string **Example** ```js 'Happy'.getSample() // => 'H' | 'a' | 'p' | 'y' ``` ### string.scan(pattern) Matching the pattern (which may be a Regexp or a String). For each match, a result is generated and either added to the result array. If the pattern contains no groups, each individual result consists of the matched string. If the pattern contains groups, each individual result is itself an array containing one entry per group. | Param | Type | | --- | --- | | pattern | string \| RegExp |