Copy link to clipboard
Copied
Greetings all,
Got another one that's probably simpler than I'm making it. This is what I'm trying to do:
I have a slider named "Camera Input Talent 1 Scale Adjust." Ideally, I'd like to be able to pull two strings from this:
string1 = "Camera Input Talent 1"
string2 = "Scale Adjust"
I like the split() function because it splits a string into an array, but all the references I've been able to find indicate that split() will only work with a delimiter that's a character. Is there a way to either get split() to work with a number of characters or a number of words? Or some other way to do what I'm describing?
There might be a simpler way, but I think this will work:
str = "Camera Input Talent 1 Scale Adjust.";
numWords = 4;
arr = str.split(" ");
arr1 = arr.slice(0,numWords);
arr2 = arr.slice(numWords);
arr1.join(" ") + "\r" + arr2.join(" ");
Copy link to clipboard
Copied
There might be a simpler way, but I think this will work:
str = "Camera Input Talent 1 Scale Adjust.";
numWords = 4;
arr = str.split(" ");
arr1 = arr.slice(0,numWords);
arr2 = arr.slice(numWords);
arr1.join(" ") + "\r" + arr2.join(" ");
Copy link to clipboard
Copied
Dan does it again! As always you know I appreciate it!