Add a space between two words

前端 未结 3 1953
粉色の甜心
粉色の甜心 2021-01-12 23:38

I have some words like \"Light Purple\" and \"Dark Red\" which are stored as \"LightPurple\" and \"DarkRed\". How do I check for the uppercase letters in the word like \"Lig

3条回答
  •  无人及你
    2021-01-13 00:30

    You could compare each character to a string of uppercase letters.

    function splitAtUpperCase(input){  
       var uppers = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";  
       //start at 1 because 0 is always uppercase
       for (var i=1; i

    The output is an array with the first and second words.

提交回复
热议问题