import { Component } from '@angular/core';
@Component({
selector: 'string-app',
template: `
<h3>String Example</h3>
{{myStr | slice:3:7}} <br/>
{{myStr | slice:3:-2}} <br/>
{{myStr | slice:6}} <br/>
{{myStr | slice:-6}} <br/>
`
})
export class StringSlicePipeComponent {
myStr: string = "abcdefghijk";
}
output.
String Example
defg
defghi
ghijk
fghijk
In my case, my string will be always ending with 3 digits.How to slice those 3 digits
Example
my string : abcdef123, ahdvvhvhv456
i want to slice 123 and 456 from the end. How to do this?
Any help would be appreciated!