Skip to content

wrapBidi

function wrapBidi(text, direction?): string;

Defined in: text.ts:436

Wraps text in Unicode directional isolates, so a name or number in one direction does not reorder the sentence around it (for example an English order number inside an Urdu message).

Uses FIRST STRONG ISOLATE (U+2068) by default, RIGHT-TO-LEFT ISOLATE (U+2067) for rtl and LEFT-TO-RIGHT ISOLATE (U+2066) for ltr, closed with POP DIRECTIONAL ISOLATE (U+2069). Any other direction is auto.

Parameter Type Default value
text string undefined
direction? BidiDirection 'auto'

string

The wrapped text, or '' when the input is not a string. Never throws.

`آرڈر ${wrapBidi('PDK-1042')} بھیج دیا گیا`;