← All pipes
Text

normalizeWhitespace

Clean pasted labels without stripping markup.

Use it in your component

Standalone component
import { Component } from '@angular/core';
import { NormalizeWhitespacePipe } from 'extra-pipe';

@Component({
  standalone: true,
  imports: [NormalizeWhitespacePipe],
  template: `{{ "  Ana\t  Sam \n" | normalizeWhitespace }}`,
})
export class ExampleComponent {

}

Template
{{ "  Ana\t  Sam \n" | normalizeWhitespace }}

Try it live.

The output below runs the packed library. Edit data, not code.

Use double quotes for text, or a number, array, object or null.
No parameters: use []. Locale is controlled separately.
This pipe has no locale override.
Live template data
readonly value = "  Ana\t  Sam \n";

{{ value | normalizeWhitespace }}

Rendered output

Ana Sam