Convert Hebrew Letters to Equivalent Number

Other than hard-coding this manually, I was wondering if there is a way that the.net infrastructure will have this built in automatically, I know that it can automatically convert Hebrew dates to georgian dates, but I need to convert Hebrew numbers to Georgian

IE א = 1 ב = 2

It goes to hundreds. See here for more details.

+4
source share
1 answer

Here's the approach you should take:

  • Make a Dictionary<char,int >, which gives a correspondence between each Hebrew letter and its numerical value
  • Parse a string one character at a time (best done from right to left)
  • For each character, find its value in the dictionary and add it to the current amount
  • Be sure to handle common scripts to extract hundreds of letters from decimal letters (double quote mark) and separate thousands of letters from hundreds (single quote mark). For example, 5770 = ה'תש"ע.`` For details, see Details in the link above.

Edit: I just published a GitHub Repo that provides functionality to convert Hebrew text to numbers and numbers to their Hebrew equivalents.

+8
source

All Articles