[ https://issues.apache.org/jira/browse/TINKERPOP-2334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17780397#comment-17780397 ]
ASF GitHub Bot commented on TINKERPOP-2334: ------------------------------------------- Cole-Greer commented on code in PR #2307: URL: https://github.com/apache/tinkerpop/pull/2307#discussion_r1374637038 ########## docs/src/upgrade/release-3.7.x.asciidoc: ########## @@ -243,6 +243,28 @@ See: link:https://tinkerpop.apache.org/docs/x.y.z/reference/#split-step[split()- See: link:https://tinkerpop.apache.org/docs/x.y.z/reference/#substring-step[substring()-step] See: link:https://issues.apache.org/jira/browse/TINKERPOP-2672[TINKERPOP-2672] +===== Format Step +This step is designed to simplify some string operations. +In general, it is similar to the string formatting function available in many programming languages. +Variable values can be picked up from Element properties, maps and scope variables. + +[source,text] +---- +gremlin> g.V().format("%{name} is %{age} years old") +==>marko is 29 years old +==>vadas is 27 years old +==>josh is 32 years old +==>peter is 35 years old +gremlin> g.V().hasLabel("person").as("a").values("name").as("p1").select("a").in("knows").format("%{p1} knows %{name}") +==>vadas knows marko +==>josh knows marko +gremlin> g.V(1).format("%{name} has %{_} connections").by(bothE().count()) +==>marko has 3 connections +---- + +See: link:https://issues.apache.org/jira/browse/TINKERPOP-2334[TINKERPOP-2334], +link:https://tinkerpop.apache.org/docs/x.y.z/reference/#format-step[all()-step] Review Comment: ```suggestion link:https://tinkerpop.apache.org/docs/x.y.z/reference/#format-step[format()-step] ``` > Add format() step > ----------------- > > Key: TINKERPOP-2334 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2334 > Project: TinkerPop > Issue Type: Improvement > Components: process > Affects Versions: 3.4.4 > Reporter: Stephen Mallette > Assignee: Valentyn Kahamlyk > Priority: Major > > Provide for a {{format()}} step which will handle result formatting to string > values. This change will help resolve the need for string concatenation > functions while providing a lot of flexibility to how results can be formed: > {code} > gremlin> g.V().hasLabel('person').format("%{n} is %{a} years old.").by('n', > 'name').by('a', 'age') > ==>marko is 29 years old. > ==>vadas is 27 years old. > ==>josh is 32 years old. > ==>peter is 35 years old. > gremlin> g.V().hasLabel('person').format("%{name} is %{age} years old.") > ==>marko is 29 years old. > ==>vadas is 27 years old. > ==>josh is 32 years old. > ==>peter is 35 years old. > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)