diff --git a/es/overviews/core/string-interpolation.md b/es/overviews/core/string-interpolation.md index 345753f122..0fba485b10 100644 --- a/es/overviews/core/string-interpolation.md +++ b/es/overviews/core/string-interpolation.md @@ -102,11 +102,11 @@ En este ejemplo, estamos intentando crear una cadena JSON mediante el uso de la Cuando el compilador encuentra la cadena `json"{ name: $name, id: $id }"` reescribe la siguiente expresión: - new StringContext("{ name:", ",id: ", "}").json(name, id) + new StringContext("{ name: ", ", id: ", " }").json(name, id) La clase implícita es utilizada para reescribir el fragmento anterior de la siguiente forma: - new JsonHelper(new StringContext("{ name:", ",id: ", "}")).json(name, id) + new JsonHelper(new StringContext("{ name: ", ", id: ", " }")).json(name, id) De este modo, el método `json` tiene acceso a las diferentes partes de las cadenas así como cada una de las expresiones. Una implementación simple, y con errores, de este método podría ser: diff --git a/ja/overviews/core/string-interpolation.md b/ja/overviews/core/string-interpolation.md index 5b4b92a3a9..1e8c84eaba 100644 --- a/ja/overviews/core/string-interpolation.md +++ b/ja/overviews/core/string-interpolation.md @@ -101,11 +101,11 @@ Scala では、全ての加工文字列リテラルは簡単なコード変換 コンパイラが `json"{ name: $name, id: $id }"` を見つけると、以下の式に書き換える: - new StringContext("{ name:", ",id: ", "}").json(name, id) + new StringContext("{ name: ", ", id: ", " }").json(name, id) さらに、implicit クラスは以下のように書き換える: - new JsonHelper(new StringContext("{ name:", ",id: ", "}")).json(name, id) + new JsonHelper(new StringContext("{ name: ", ", id: ", " }")).json(name, id) そのため、`json` メソッドは生の String 部分と渡される式の値をみることができる。シンプルな (だけどバギーな) 実装を以下に示す: diff --git a/overviews/core/_posts/2012-09-21-string-interpolation.md b/overviews/core/_posts/2012-09-21-string-interpolation.md index 880c75c108..326b591d06 100644 --- a/overviews/core/_posts/2012-09-21-string-interpolation.md +++ b/overviews/core/_posts/2012-09-21-string-interpolation.md @@ -112,11 +112,11 @@ In this example, we're attempting to create a JSON literal syntax using string i When the compiler encounters the literal `json"{ name: $name, id: $id }"` it rewrites it to the following expression: - new StringContext("{ name:", ",id: ", "}").json(name, id) + new StringContext("{ name: ", ", id: ", " }").json(name, id) The implicit class is then used to rewrite it to the following: - new JsonHelper(new StringContext("{ name:", ",id: ", "}")).json(name, id) + new JsonHelper(new StringContext("{ name: ", ", id: ", " }")).json(name, id) So, the `json` method has access to the raw pieces of strings and each expression as a value. A simple (buggy) implementation of this method could be: