#arabicString
A Javascript library that extends the native String
object with methods to help when dealing with Arabic strings for node and the browser.
##Usage ###node
require('arabicString')
###browser
<script src="arabicString.js"></script>
##String#howArabic()
The percentage of Arabic letters in the String
.
'foobar'.howArabic()
//=> 0.0
'فوو bar'.howArabic()
//=> 0.5
'فوبار'.howArabic()
//=> 1.0
##String#howNotArabic()
The precentage of non-Arabic letters in the String
.
'فوبار'.howNotArabic()
//=> 0.0
'فوو bar'.howNotArabic()
//=> 0.5
'foobar'.howNotArabic()
//=> 1.0
##String#isArabic(threshold)
Is the String
Arabic, based on a given threshold
between 0
and 1
. Defaults to 0.79
.
'فوو'.isArabic()
//=> true
'فوو bar baz'.isArabic(0.5)
//=> flase
##String#hasArabic()
Does the String
have any Arabic letter.
'فوو bar'.hasArabic()
//=> ture
'foo bar'.hasArabic()
//=> false
##String#removeTashkel()
Will return the String
without the diacritics
'مٌحمْد'.removeTashkel()
//=> 'محمد'
'وَتُرى الْكَوَاكِبِ فِي الْمَجَرَّةِ شَرَعَا*** مِثْلُ الظِّباءِ كوارعا فِي جَدْوَلِ'.removeTashkel()
//=> 'وترى الكواكب في المجرة شرعا *** مثل الظباء كوارعا في جدول'
##String#removeNonArabic()
Will return the String
without the non-Arabic letters
'hello مرحبا'.removeNonArabic()
//=> 'مرحبا'
##String#removeArabic()
Will return the String
without the Arabic letters
'hello مرحبا'.removeArabic()
//=> 'hello'
MIT
Copyright © 2012 - Ahmad Salman