Jump to content

gibrish to hebrew function


shai
 Share

Recommended Posts

sometimes user type hebrew but the keyboard is on english mode so it get wrong text (its called gibrish)

with this function you can easy convert worng text to readable hebrew.

maybe it is be helpful to other users here

Func gibrish_to_hebrew($string)
    Local $aArray[31][2] = [['t', 'א'],['c', 'ב'],['d', 'ג'],['s', 'ד'],['v', 'ה'],["u", 'ו'],['z', 'ז'], _
                            ['j', 'ח'],['y', 'ט'],['h', 'י'],['f', 'כ'],['l', 'ך'],['k', 'ל'],['n', 'מ'], _
                            ['o', 'ם'],['b', 'נ'],['i', 'ן'],['x', 'ס'],['g', 'ע'],['p', 'פ'],[';', 'ף'], _
                            ['m', 'צ'],['.', 'ץ'],['e', 'ק'],['r', 'ר'],['a', 'ש'],[',', 'ת'],['/', '.'], _
                            ["'", ','],['q', '/']]
    Local $agibrish = StringRegExp($string, "(.)", 3)
    Local $sRet = ""
    For $i = 0 To UBound($agibrish) - 1
        Local $match = False
        For $x = 0 To UBound($aArray) - 1
            If $aArray[$x][0] = $agibrish[$i] Then
                $match = True
                $sRet &= $aArray[$x][1]
            EndIf
        Next
        If Not $match Then $sRet &= $agibrish[$i]
    Next
    Return $sRet
EndFunc

 

Edited by shai
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...