in reply to Re^2: Reversing Arabic String direction
in thread Reversing Arabic String direction

nope IMHO thats the way it should be in Arabic, if numbers were reversed:

DB<115> join "", reverse map { /\d/ ? $_ : scalar reverse $_ } split + /(\d+)/, name_21 => "21_eman"

But I didn't check your code...

Cheers Rolf

(addicted to the Perl Programming Language)

Replies are listed 'Best First'.
Re^4: Reversing Arabic String direction
by boftx (Deacon) on Jul 10, 2014 at 22:11 UTC

    Like I said, I took a brute-force approach. I'm not surprised at all (and expected) that a better, cleaner way would be apparent to one such as yourself. :)

    The code I provided will produce "21_eman" when given "name_21" as input. I think yours does the same (but I didn't test yours.) I have no idea what the correct way of dealing with that is.

    You must always remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.
      > I have no idea what the correct way of dealing with that is.

      Arabic is right to left but numbers are written with the lowest digit first, thats why they are the same again (double reversed if you want)

      I suppose someone didn't know and encoded it wrong.

      update

      see example

      Cheers Rolf

      (addicted to the Perl Programming Language)