Last active
September 6, 2017 12:38
-
-
Save DerZyklop/2885792ad63110971e2749237fd8f09f to your computer and use it in GitHub Desktop.
Add the correct genitive ending to a given name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add the correct genitive ending to a given name. | |
*/ | |
private addGenitiveEnding(name : string) : string { | |
if (name.charAt(name.length - 1).match(/[s|z|ß|x]/)) { | |
return name + '’'; | |
} else { | |
return name + 's'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment