diff --git a/docs/expressions/syntax.md b/docs/expressions/syntax.md index ee4cb4977..7cae447e4 100644 --- a/docs/expressions/syntax.md +++ b/docs/expressions/syntax.md @@ -391,6 +391,11 @@ a string can be retrieved or replaced by using indexes. Strings can be converted to a number using function `number`, and numbers can be converted to a string using function `string`. +When setting the value of a character in a string, the character that has been +set is returned. Likewise, when a range of characters is set, that range of +characters is returned. + + ```js var parser = math.parser(); @@ -399,10 +404,11 @@ parser.eval('"hello"'); // String, "hello" // string manipulation parser.eval('a = concat("hello", " world")'); // String, "hello world" -parser.eval('size(a)'); // Number, 11 +parser.eval('size(a)'); // Matrix [11] parser.eval('a[1:5]'); // String, "hello" -parser.eval('a[1] = "H"'); // String, "Hello" -parser.eval('a[7:12] = "there!"'); // String, "Hello there!" +parser.eval('a[1] = "H"'); // String, "H" +parser.eval('a[7:12] = "there!"'); // String, "there!" +parser.eval('a'); // String, "Hello there!" // string conversion parser.eval('number("300")'); // Number, 300