Open paulroth3d opened 2 years ago
Perhaps some guidance here: https://stackoverflow.com/questions/10590098/javascript-regexp-word-boundaries-unicode-characters
So far in testing, I could not find one that passes all the unit tests for them though. (But I wasn't very thorough, so I may have missed one)
Link to function for when I remember: https://github.com/paulroth3d/jupyter-ijavascript-utils/blob/main/src/format.js#L493
All that is needed is that each string needs the first characters of each word to be sent to utils.format.capitalize
(That DOES properly capitalize πΆπ²ππΌπ²π
to ππ²ππΌπ²π
)
module.exports.capitalizeAll = function capitalizeAll(str) {
//-- see if there is anything better to split at the start of word boundaries.
return (str || '').split(/\b/)
.map(FormatUtils.capitalize)
.join('');
};
When running utils.format.capitalizeAll('alpha πΆπ²ππΌπ²π') I expect:
Alpha ππ²ππΌπ²π
but instead I get:
Alpha πΆπ²ππΌπ²π
It seems there is a bug with Regex in matching wordboundaries for multi-character unicode characters.