Skip to content
4 changes: 1 addition & 3 deletions src/utilities/conversion.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@ import p5 from '../core/main';
* let str = '20';
* let diameter = float(str);
* ellipse(width / 2, height / 2, diameter, diameter);
* describe('20-by-20 white ellipse in the center of the canvas');
* </code></div>
* <div class='norender'><code>
* print(float('10.31')); // 10.31
* print(float('Infinity')); // Infinity
* print(float('-Infinity')); // -Infinity
* </code></div>
*
* @alt
* 20 by 20 white ellipse in the center of the canvas
*/
p5.prototype.float = function(str) {
if (str instanceof Array) {
Expand Down
36 changes: 12 additions & 24 deletions src/utilities/string_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ import '../core/friendly_errors/fes_core';
* let separator = ' ';
* let message = join(array, separator);
* text(message, 5, 50);
* describe('“Hello world!” displayed middle left of canvas.');
* </code>
* </div>
*
* @alt
* "hello world!" displayed middle left of canvas.
*/
p5.prototype.join = function(list, separator) {
p5._validateParameters('join', arguments);
Expand Down Expand Up @@ -69,11 +67,9 @@ p5.prototype.join = function(list, separator) {
* let regexp = 'p5js\\*';
* let m = match(string, regexp);
* text(m, 5, 50);
* describe('“p5js*” displayed middle left of canvas.');
* </code>
* </div>
*
* @alt
* "p5js*" displayed middle left of canvas.
*/
p5.prototype.match = function(str, reg) {
p5._validateParameters('match', arguments);
Expand Down Expand Up @@ -166,12 +162,11 @@ p5.prototype.matchAll = function(str, reg) {
* // Draw dividing line
* stroke(120);
* line(0, 50, width, 50);
*
* describe('“0321.00” middle top, “-1321.00” middle bottom canvas');
* }
* </code>
* </div>
*
* @alt
* "0321.00" middle top, -1321.00" middle bottom canvas
*/
/**
* @method nf
Expand Down Expand Up @@ -265,12 +260,11 @@ function doNf(num, left, right) {
* // Draw dividing line
* stroke(120);
* line(0, 50, width, 50);
*
* describe('“11,253,106.115” top middle and “1.00,1.00,2.00” displayed bottom mid');
* }
* </code>
* </div>
*
* @alt
* "11,253,106.115" top middle and "1.00,1.00,2.00" displayed bottom mid
*/
/**
* @method nfc
Expand Down Expand Up @@ -342,12 +336,11 @@ function doNfc(num, right) {
* // Draw dividing line
* stroke(120);
* line(0, 50, width, 50);
*
* describe('“+11253106.11” top middle and “-11253106.11” displayed bottom middle');
* }
* </code>
* </div>
*
* @alt
* "+11253106.11" top middle and "-11253106.11" displayed bottom middle
*/
/**
* @method nfp
Expand Down Expand Up @@ -420,12 +413,11 @@ function addNfp(num) {
* // Draw dividing line
* stroke(120);
* line(0, 50, width, 50);
*
* describe('“0321.00” top middle and “-1321.00” displayed bottom middle');
* }
* </code>
* </div>
*
* @alt
* "0321.00" top middle and "-1321.00" displayed bottom middle
*/
/**
* @method nfs
Expand Down Expand Up @@ -470,11 +462,9 @@ function addNfs(num) {
* text(splitString[0], 5, 30);
* text(splitString[1], 5, 50);
* text(splitString[2], 5, 70);
* describe('“Pat” top left, “Xio” mid left, and “Alex” displayed bottom left');
* </code>
* </div>
*
* @alt
* "pat" top left, "Xio" mid left and "Alex" displayed bottom left
*/
p5.prototype.split = function(str, delim) {
p5._validateParameters('split', arguments);
Expand Down Expand Up @@ -548,11 +538,9 @@ p5.prototype.splitTokens = function(value, delims) {
* <code>
* let string = trim(' No new lines\n ');
* text(string + ' here', 2, 50);
* describe('“No new lines here” displayed center canvas');
* </code>
* </div>
*
* @alt
* "No new lines here" displayed center canvas
*/
/**
* @method trim
Expand Down
28 changes: 7 additions & 21 deletions src/utilities/time_date.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ import p5 from '../core/main';
* <code>
* let d = day();
* text('Current day: \n' + d, 5, 50);
* describe('Current day is displayed');
* </code>
* </div>
*
* @alt
* Current day is displayed
*/
p5.prototype.day = function() {
return new Date().getDate();
Expand All @@ -39,11 +37,9 @@ p5.prototype.day = function() {
* <code>
* let h = hour();
* text('Current hour:\n' + h, 5, 50);
* describe('Current hour is displayed');
* </code>
* </div>
*
* @alt
* Current hour is displayed
*/
p5.prototype.hour = function() {
return new Date().getHours();
Expand All @@ -60,11 +56,9 @@ p5.prototype.hour = function() {
* <code>
* let m = minute();
* text('Current minute: \n' + m, 5, 50);
* describe('Current minute is displayed');
* </code>
* </div>
*
* @alt
* Current minute is displayed
*/
p5.prototype.minute = function() {
return new Date().getMinutes();
Expand All @@ -82,11 +76,9 @@ p5.prototype.minute = function() {
* <code>
* let millisecond = millis();
* text('Milliseconds \nrunning: \n' + millisecond, 5, 40);
* describe('number of milliseconds since sketch has started displayed');
* </code>
* </div>
*
* @alt
* number of milliseconds since sketch has started displayed
*/
p5.prototype.millis = function() {
if (this._millisStart === -1) {
Expand All @@ -108,11 +100,9 @@ p5.prototype.millis = function() {
* <code>
* let m = month();
* text('Current month: \n' + m, 5, 50);
* describe('Current month is displayed');
* </code>
* </div>
*
* @alt
* Current month is displayed
*/
p5.prototype.month = function() {
//January is 0!
Expand All @@ -130,11 +120,9 @@ p5.prototype.month = function() {
* <code>
* let s = second();
* text('Current second: \n' + s, 5, 50);
* describe('Current second is displayed');
* </code>
* </div>
*
* @alt
* Current second is displayed
*/
p5.prototype.second = function() {
return new Date().getSeconds();
Expand All @@ -151,11 +139,9 @@ p5.prototype.second = function() {
* <code>
* let y = year();
* text('Current year: \n' + y, 5, 50);
* describe('Current year is displayed');
* </code>
* </div>
*
* @alt
* Current year is displayed
*/
p5.prototype.year = function() {
return new Date().getFullYear();
Expand Down