Template:GetOptionValue

  • Revision slug: Template:GetOptionValue
  • Revision title: Template:GetOptionValue
  • Revision id: 481551
  • Created:
  • Creator: Sheppy
  • Is current revision? Yes
  • Comment

Revision Content

<% // Given a string of options and their values, returns the value of a // specific option. // // Parameters: // // $0 The option string // $1 The option whose value is to be returned // // Option list format: // // The option list is a semicolon-delineated list of key/value pairs. For example: // // "optionname:value; optionname:value" var value = null; /* assume no match */ // First, split the string into an array in which each item is a key and its // value as a single string var list = $0.split(';'); // Next, parse each of those items %>

Revision Source

<%
// Given a string of options and their values, returns the value of a
// specific option.
//
// Parameters:
//
//  $0  The option string
//  $1  The option whose value is to be returned
//
// Option list format:
//
// The option list is a semicolon-delineated list of key/value pairs. For example:
//
// "optionname:value; optionname:value"

var value = null;   /* assume no match */

// First, split the string into an array in which each item is a key and its
// value as a single string

var list = $0.split(';');

// Next, parse each of those items


%>
Revert to this revision