Home > OS >  how to remove Yiddish scoring from a string in PHP
how to remove Yiddish scoring from a string in PHP

Time:11-04

I get characters from a API URL request like this ִֵנׂקֹוַדֹּוֶת and I went to get only the text. How can I convert it in PHP AND in javascript?

from נׂקֹוַדֹּוֶת
to נקודות

CodePudding user response:

in PHP you can use this

$str = 'נׂקֹוַדֹּוֶת ';
$rule = 'NFD; [:Nonspacing Mark:] Remove; NFC';

$myTrans = Transliterator::create($rule); 
echo $myTrans->transliterate($str);

CodePudding user response:

FOR JavaScript you can use this

<!DOCTYPE html>
<html>
<body>
<p>JavaScript can change נקודות content.</p>

<p id="demo">JavaScript can change נקודות content.</p>

<script>
var string = "נׂקֹוַדֹּוֶת";

var string_norm = string.replace(/[ְֱֲֳִֵֶַָֹֹּׁׂ]/g, '');
document.getElementById("demo").innerHTML = (string_norm);
</script>

</body>
</html>
  • Related