Seen-Arabic / Arabic-Services-JavaScript

A versatile library offering utility functions for processing and transforming Arabic text. Can be used in Node.js and the browser.
https://www.npmjs.com/package/arabic-services
GNU General Public License v3.0
15 stars 2 forks source link

Convert Letter to word - تحويل الحرف إلى كلمة #2

Closed AbdelrahmanBayoumi closed 11 months ago

AbdelrahmanBayoumi commented 2 years ago

https://seen-arabic.github.io/Arabic-Services/letter-to-word/

image

function letterToWord(word) {
  let newWord = ""
  for (i in word) {
    letter = word[i]
    if (PRONOUNCED_LETTERS.hasOwnProperty(letter)) {
      newWord += PRONOUNCED_LETTERS[letter];
      if (i != word.length) {
        newWord += " "
      }
    } else {
      newWord += letter
    }
  }
  return newWord.trim();
}
AbdelrahmanBayoumi commented 11 months ago