What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » PHP and/or JScript help: RTL text

PHP and/or JScript help: RTL text
Author: Message:
Jarrod
Veteran Member
*****

Avatar
woot simpson

Posts: 1304
Reputation: 20
– / Male / Flag
Joined: Sep 2006
RE: PHP and/or JScript help: RTL text
i know it's not quite what you wanted as we all know i don't code php/jscript
but this is my rendition in python and why i love  it,
code:

def reverse_rtl(x):
    beta = <rtl characters including space>
    count  = 0
    y = []
    zz = []
    s = ""
    a = ""
    b = ""
    for letter in x:
        #print count
        if letter in beta:
            y.append(letter)
        else:
            zz.append(letter)
           
           
        count += 1

    y = y[::-1]
    for item in y:
        s = s + item
    for item in zz:
        a = a + item
        if zz[-1] != " " and zz[-1] == item:
            a = a + " "

    b = a + s

    return b



u just need some one to translate it

[edit: just added an if statement and fixed it to return the whole string instead of just the rtl]

bug: it does strip the spaces off ltr text with more than 1 space, but rtl text is fine

This post was edited on 09-18-2008 at 11:56 AM by Jarrod.

[Image: 5344.png]
[Image: sig.png]

A.k.a. The Glad Falconer














09-18-2008 06:30 AM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
PHP and/or JScript help: RTL text - by MeEtc on 09-18-2008 at 05:46 AM
RE: PHP and/or JScript help: RTL text - by Jarrod on 09-18-2008 at 06:30 AM
RE: PHP and/or JScript help: RTL text - by MeEtc on 09-18-2008 at 07:17 PM
RE: PHP and/or JScript help: RTL text - by Jarrod on 09-19-2008 at 07:04 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On