Convert string to sentence case in javascript

前端 未结 10 654
别那么骄傲
别那么骄傲 2020-12-03 19:19

I want a string entered should be converted to sentence case in whatever case it is.

Like

hi all, this is derp. thank you all to answer my qu

10条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-03 20:10

    Try this, It will work fine for you. It will also work for String having leading spaces.

    var string="hi all, this is derp. thank you all to answer my query.";
    var n=string.split(".");
    var vfinal=""
    for(i=0;i

提交回复
热议问题