# Can "Format" component call list items by index?

**URL:** <https://discourse.mcneel.com/t/can-format-component-call-list-items-by-index/70530>\
**Category:** Grasshopper\
**Created:** [September 9, 2018, 9:47am UTC](https://discourse.mcneel.com/t/can-format-component-call-list-items-by-index/70530 "2018-09-09T09:47:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anikolo](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/anikolo/32/475580_2.png) [@anikolo](https://discourse.mcneel.com/u/anikolo)\
**Post date:** [September 9, 2018, 9:47am UTC](https://discourse.mcneel.com/t/can-format-component-call-list-items-by-index/70530/1 "2018-09-09T09:47:54Z")

</div>

Hi, this is a question that arose from another [question](https://discourse.mcneel.com/t/select-a-column-from-a-list-in-text/70524/2):

When we use format we write {0} in order to call input 0. But if 0 is a tree, can we call individual items by index?  
In the image below, I tried to call indexes 0,1 and 2 so as to create three distinct points (each corresponding to one of the three lists).  
Of course, the component recognized the parentheses as text instead of an argument but is there a specific notation so as to call items?  
(I hope that made sense)

[input.gh](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/a/5/a53b3930e880265dc4ac20ca54cbe702189c6421.gh) (5.7 KB)

 ![text](https://global.discourse-cdn.com/mcneel/original/3X/3/9/393c2d55b3a65344d1c3b83ec5bd79c4c075349d.png)

---

<div class="post-metadata">

**Author:** ![Dani\_Abalde](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dani_abalde/32/759411_2.png) [@Dani\_Abalde](https://discourse.mcneel.com/u/Dani_Abalde)\
**Post date:** [September 9, 2018, 11:52am UTC](https://discourse.mcneel.com/t/can-format-component-call-list-items-by-index/70530/2 "2018-09-09T11:52:39Z")

</div>

1. There isn’t, it’s based on a [.NET method](https://msdn.microsoft.com/es-es/library/system.string.format%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396) for building strings.
2. The inputs have item access, so the component will be executed once for each input. If they had other accesses, it would give more disadvantages than advantages. In addition, the original .NET method works with individual objects.
3. You can do the same in another way (and I’m sure you can think of several ways), why complicate this component?
4. Anyway, I guess you just wanted to take the doubt away.

EDIT:  
Syntax: `{ index [, alignment][: formatString] }`  
_[optional]_  
[https://docs.microsoft.com/es-es/dotnet/standard/base-types/composite-formatting](https://docs.microsoft.com/es-es/dotnet/standard/base-types/composite-formatting)

---

<div class="post-metadata">

**Author:** ![anikolo](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/anikolo/32/475580_2.png) [@anikolo](https://discourse.mcneel.com/u/anikolo)\
**Post date:** [September 9, 2018, 12:34pm UTC](https://discourse.mcneel.com/t/can-format-component-call-list-items-by-index/70530/3 "2018-09-09T12:34:53Z")

</div>

> [@Dani\_Abalde](#):
>
> Anyway, I guess you just wanted to take the doubt away.

exactly, sometimes you find shortcuts that can reduce the amount of components needed for an operation.  
Thanks Dani!
