Skip to content

Commit 20eecc4

Browse files
author
Ville Saukkonen
committed
resolve #197 add nordic character support for titleCase
1 parent 4b930bd commit 20eecc4

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/string.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ string.js - Copyright (C) 2012-2014, JP Richardson <[email protected]>
463463
titleCase: function() {
464464
var s = this.s;
465465
if (s) {
466-
s = s.replace(/(^[a-z]| [a-z]|-[a-z]|_[a-z])/g,
466+
s = s.replace(/(^[a-zæøåäö]| [a-zæøåäö]|-[a-zæøåäö]|_[a-zæøåäö])/g,
467467
function($1){
468468
return $1.toUpperCase();
469469
}

test/string.test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,13 @@
744744
EQ (S(null).titleCase().s,null)
745745
EQ (S(undefined).titleCase().s,undefined)
746746
})
747+
// it('TitleCases nordics characters', function () {
748+
// EQ (S('ämpäri is a finnish word').titleCase().s, 'Ämpäri Is A Finnish Word')
749+
// EQ (S('Öljy is finnish and means oil').titleCase().s, 'Öljy Is Finnish And Means Oil')
750+
// EQ (S('åland is a place').titleCase().s, 'Åland Is A Place')
751+
// EQ (S('ødele sounds like norwegian').titleCase().s, 'Ødele Sounds Like Norwegian')
752+
// EQ (S('ærlandaa may be norwegian or danish, dunno').titleCase().s, 'Ærlandaa May Be Norwegian Or Danish, Dunno')
753+
// })
747754
})
748755

749756
describe('- toFloat([precision])', function() {

0 commit comments

Comments
 (0)