Camel Case Fixed

This commit is contained in:
Luis Fernando Molina committed 2020-12-29 15:20:08 +01:00
1 parent 148b5e2f2c
commit 1f4c232784
2 files changed
+17 -5

No files matched your search

@@ -3577,7 +3577,7 @@ function newSuperalgosDocSpace() {
function addBold(text) {
let splittedText = text.split(':')
if (text.indexOf(':' >= 0)) {
if (text.indexOf(':') >= 0) {
return '<b>' + text.substring(0, text.indexOf(':') + 1) + '</b>' + text.substring(text.indexOf(':') + 1, text.length)
} else {
return text
+16 -4
View File
@@ -7,11 +7,23 @@ function newSuperalgosUtilitiesStrings() {
return thisObject
function fromCamelCaseToUpperWithSpaces(text) {
let result = text.replace( /([A-Z])/g, " $1" );
let result = text.replace(/([A-Z])/g, " $1");
return result.charAt(0).toUpperCase() + result.slice(1);
}
}
function isCamelCase(text) {
return /^([a-z]+)(([A-Z]([a-z]+))+)$/.test(text)
}
/*
We are not only going to detect standard Camel Case, but also
we will accept strings with numbers and dots, so that
object paths test positive.
*/
const result = /^[A-Za-z0-9.]+$/.test(text)
if (result === false) { return false }
let character = text[0]
if (character !== character.toLowerCase()) {
return false
}
return true
}
}