Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixes example code in SC.String.fmt #858

Merged
merged 1 commit into from

2 participants

@toasterlovin

What I changed:

  1. The example code in the docs for SC.String.fmt now actually works.
  2. The examples will now be picked up as code snippets and not just plain text.

Some questions:

  1. Should I be submitting pull requests against the master branch, or some other one?
  2. The examples are using String.fmt, but they are in the docs for SC.String.fmt. That might not be obvious to a newbie. Is that something worth elaborating on in the docs?
@etgryphon etgryphon merged commit e070541 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 28, 2012
  1. Fixes example code in SC.String.fmt

    Rico Jones authored
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 5 deletions.
  1. +9 −5 frameworks/runtime/system/string.js
View
14 frameworks/runtime/system/string.js
@@ -45,13 +45,17 @@ SC.String = /** @scope SC.String.prototype */ {
Indexed Parameters
--------------------
- Indexed parameters are just arguments you pass into format.
-
- For example, if you call fmt("%@1 %3 %2", 1, 2, 3), you'll get "1 3 2" as output.
+ Indexed parameters are just arguments you pass into format. For example:
+
+ "%@1 %@3 %@2".fmt(1, 2, 3)
+
+ // -> "1 3 2"
- If you don't supply a number, it will use them in the order you supplied. For instance:
+ If you don't supply a number, it will use them in the order you supplied. For example:
- "abc".fmt("%@, %@", "Iskander", "Alex") would return "Iskander, Alex".
+ "%@, %@".fmt("Iskander", "Alex")
+
+ // -> "Iskander, Alex"
Named Paramters
--------------------
Something went wrong with that request. Please try again.