Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function fixCasing(value) {
- function randomCase (word) {
- var result = "";
- for (var i = 0; i < word.length; i++) {
- var randol = Math.random();
- if (randol <= 0.5) {
- result += word.charAt(i).toUpperCase();
- }
- else {
- result += word.charAt(i).toLowerCase();
- }
- }
- return result;
- }
- var result = value.match(/<mixcase>(.*?)<\/mixcase>/g).map(function (val) {
- return val.replace(/<\/*.*?>/g, '');
- });
- var applyMixed = value;
- value = '\"' + value + '\"';
- console.log(value);
- for (var i = 0; i < result.length; i++) {
- value += ".replace('/<mixcase>(.*?)<\/mixcase>\/g, result[" + i + '])';
- }
- var newString = eval(value);
- console.log(newString);
- //var cleanText = value.replace(/<\/?[^>]+(>|$)/g, "");
- // console.log(cleanText);
- }
- fixCasing('We are <mixcase>living</mixcase> in a <upcase>yellow submarine</upcase>. We <mixcase>dont</mixcase> have <lowcase>anything<\/lowcase> else.');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement