Created
April 6, 2017 22:45
-
-
Save wmcraver/108df42afb1277ebcfa41135230da0a0 to your computer and use it in GitHub Desktop.
Tealium Extension - capitalize first letter of each word in string
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
// b.channel = b.channel // The data layer value goes here. Should look like: one two three. | |
channelSplit = b.channel.split(" "); | |
for (i = 0; i < channelSplit.length; i++) { | |
channelSplit[i] = channelSplit[i].substring(0,1).toUpperCase() + channelSplit[i].substring(1,channelSplit[i].length); | |
} | |
b.channel = channelSplit.join(" "); // Change sectionName to the data layer variable. should look like: One Two Three. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment