Click here to Skip to main content
15,882,830 members
Home / Discussions / Web Development
   

Web Development

 
AnswerRe: html incorrectly displayed dashed border Pin
User 418025428-Apr-17 9:32
User 418025428-Apr-17 9:32 
Questionsave client side form data to disk Pin
bandula ck26-Apr-17 2:55
bandula ck26-Apr-17 2:55 
AnswerRe: save client side form data to disk Pin
W Balboos, GHB26-Apr-17 6:28
W Balboos, GHB26-Apr-17 6:28 
GeneralRe: save client side form data to disk Pin
bandula ck26-Apr-17 9:15
bandula ck26-Apr-17 9:15 
GeneralRe: save client side form data to disk Pin
W Balboos, GHB27-Apr-17 0:02
W Balboos, GHB27-Apr-17 0:02 
QuestionFiltering Gallery Pin
Member 1315220725-Apr-17 12:40
Member 1315220725-Apr-17 12:40 
QuestionJavaScript Question #3 Pin
Kevin Marois25-Apr-17 8:44
professionalKevin Marois25-Apr-17 8:44 
AnswerRe: JavaScript Question #3 Pin
Richard Deeming25-Apr-17 8:52
mveRichard Deeming25-Apr-17 8:52 
It's using a regular expression, so closer to Regex.Replace with a match evaluator function[^]:
JavaScript
// A simple templating method for replacing placeholders enclosed in curly braces.
if (!String.prototype.supplant) {
    String.prototype.supplant = function (dataObject) {
        return this.replace(
            /{([^{}]*)}/g, // The regular expression to match (see links below)
            function (wholeMatch, propertyName) {
                var dataValue = dataObject[propertyName];
                return typeof dataValue === 'string' || typeof dataValue === 'number' 
                    ? dataValue 
                    : wholeMatch;
            }
        );
    };
}

String.prototype.replace() - JavaScript | MDN[^]
Regexper - /{([^{}]*)}/g[^]
Refiddle - /{([^{}]*)}/g[^]



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: JavaScript Question #3 Pin
Kevin Marois25-Apr-17 10:51
professionalKevin Marois25-Apr-17 10:51 
GeneralRe: JavaScript Question #3 Pin
Kevin Marois25-Apr-17 12:29
professionalKevin Marois25-Apr-17 12:29 
AnswerRe: JavaScript Question #3 Pin
Jon McKee25-Apr-17 9:53
professionalJon McKee25-Apr-17 9:53 
GeneralRe: JavaScript Question #3 Pin
Kevin Marois25-Apr-17 10:51
professionalKevin Marois25-Apr-17 10:51 
GeneralRe: JavaScript Question #3 Pin
Kevin Marois25-Apr-17 10:54
professionalKevin Marois25-Apr-17 10:54 
GeneralRe: JavaScript Question #3 Pin
Richard Deeming25-Apr-17 12:31
mveRichard Deeming25-Apr-17 12:31 
GeneralRe: JavaScript Question #3 Pin
Kevin Marois25-Apr-17 12:32
professionalKevin Marois25-Apr-17 12:32 
QuestionNext JavaScript Question Pin
Kevin Marois25-Apr-17 7:50
professionalKevin Marois25-Apr-17 7:50 
AnswerRe: Next JavaScript Question Pin
Richard Deeming25-Apr-17 8:14
mveRichard Deeming25-Apr-17 8:14 
GeneralRe: Next JavaScript Question Pin
Kevin Marois25-Apr-17 8:16
professionalKevin Marois25-Apr-17 8:16 
GeneralRe: Next JavaScript Question Pin
Richard Deeming25-Apr-17 8:22
mveRichard Deeming25-Apr-17 8:22 
GeneralRe: Next JavaScript Question Pin
Kevin Marois25-Apr-17 8:23
professionalKevin Marois25-Apr-17 8:23 
QuestionQuick JavaScript Question Pin
Kevin Marois25-Apr-17 6:27
professionalKevin Marois25-Apr-17 6:27 
AnswerRe: Quick JavaScript Question Pin
Richard Deeming25-Apr-17 6:59
mveRichard Deeming25-Apr-17 6:59 
GeneralRe: Quick JavaScript Question Pin
Kevin Marois25-Apr-17 7:09
professionalKevin Marois25-Apr-17 7:09 
GeneralRe: Quick JavaScript Question Pin
Kevin Marois25-Apr-17 7:16
professionalKevin Marois25-Apr-17 7:16 
GeneralRe: Quick JavaScript Question Pin
Richard Deeming25-Apr-17 8:10
mveRichard Deeming25-Apr-17 8:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.