## Hl7Field.getComponent() method

Returns an HL7 component by index.

Note that the index is 1-based, not 0-based.

For example, to get the first component, use `getComponent(1)`. This aligns with HL7 component names such as MSH.9.2.

**Signature:**

```typescript
getComponent(component: number, subcomponent?: number, repetition?: number): string;
```

## Parameters

| Parameter   | Type     | Description                                  |
|-------------|----------|----------------------------------------------|
| component   | number   | The component index.                        |
| subcomponent| number   | _(Optional)_ Optional subcomponent index.   |
| repetition  | number   | _(Optional)_ Optional repetition index.      |

**Returns:**

string

The string value of the specified component.
