Because Arabic text is automatically reversed in PowerShell, I have to reverse it to make it readable.
For example, the text ‘مرحبا’ , will look ‘ابحرم’
I can change them one by one, but I have difficulty with many words at once.
function ReservedText {
Return ( -Join ($Args.ToCharArray() | Sort {(--$script:i)}) )
}
$AJoin = 'ابتثجحخدذرزسشصضطظعغفقكلمنهوي'
$AMatch = $AJoin.ToCharArray() -join '|'
$data = @(
"1. Kata kerja untuk bentuk tunggal laki-laki dalam bahasa Arab adalah?"
" a) 'تفعل'"
" b) 'تفعلان'"
" c) 'يفعلون'"
" d) 'يفعل'"
"2. 'تلميذ' adalah bentuk mufrad dari kata?"
" a) 'تلاميذ'"
" b) 'تلميذات'"
" c) 'تلميذان'"
" d) 'تلميذين'"
)
ReservedText 'بيتان'
$Newdata = $data | Foreach {
If ($_.Split("'") -match $AMatch) {
'configuous to continue'
}
}
$Newdata; pause
$data
is only 2 out of 50 taken from a .txt
file, as example.
From the script, i can reserve one word ‘بيتان’ with command ReservedText 'بيتان'
.
From $data
, I want to change every Arabic word into reverse letter order, then save it in $Newdata
. I’m not capable enough to do it yet.
I appreciate all your tricks and opinions. Thank you.