Phaser.Utils.reverseString will take the given string, reverse it, and then return it.

This commit is contained in:
Richard Davey 2016-06-27 22:43:53 +01:00
parent a0c771d47e
commit fbd1ba05f7
3 changed files with 16 additions and 1 deletions

View file

@ -321,7 +321,7 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
* The Loader has a new property `headers`. This is an object checked by XHR Requests, used to set the Request Header of certain file types. JSON and XML are pre-configured, but you can add to, or modify this property as required (thanks @stoneman1 #2585 #2485)
* Phaser now has support for Typings, the TypeScript Definition Manager. See the `typescript/readme.md` file for installation instructions (thanks @monagames #2576)
*
* Phaser.Utils.reverseString will take the given string, reverse it, and then return it.
### Updates

View file

@ -10,6 +10,20 @@
*/
Phaser.Utils = {
/**
* Takes the given string and reverses it, returning the reversed string.
* For example if given the string `Atari 520ST` it would return `TS025 iratA`.
*
* @method Phaser.Utils.reverseString
* @param {string} string - The string to be reversed.
* @return {string} The reversed string.
*/
reverseString: function (string) {
return string.split('').reverse().join('');
},
/**
* Gets an objects property by string.
*

View file

@ -5468,6 +5468,7 @@ declare module Phaser {
static setProperty(obj: any, prop: string, value: any): any;
static chanceRoll(chance: number): boolean;
static randomChoice(choice1: string | number, choice2: any): any;
static reverseString(string: string): string;
static parseDimension(size: any, dimension: number): number;
static pad(str: string, len?: number, pad?: string, dir?: number): string;
static isPlainObject(object: any): boolean;