ā08-05-2013 01:21 AM - edited ā03-14-2019 12:10 PM
hi,
i want to split a variable into a string array in UCCX 8.5, is there a function in UCCX that can help or how can i include java code.
e.g.
usman,0345,XYZ
i want to split it in string array,like this
Str[0]= usman
Str[1]=0345
Str[2]=XYZ
Solved! Go to Solution.
ā08-05-2013 09:41 AM
Variables
String original_string = "usman,0345,XYZ" String[] split_up_string_array = null
Script
Set split_up_string_array = original_string.split(",")
The value of the array will now look like this:
new String[] {"usman", "0345", "XYZ"}
And to access them, you could do this:
Set name = split_up_string_array[0] Set acct_num = split_up_string_array[1] Set site_code = split_up_string_array[2]
Anthony Holloway
Please use the star ratings to help drive great content to the top of searches.
ā08-05-2013 09:41 AM
Variables
String original_string = "usman,0345,XYZ" String[] split_up_string_array = null
Script
Set split_up_string_array = original_string.split(",")
The value of the array will now look like this:
new String[] {"usman", "0345", "XYZ"}
And to access them, you could do this:
Set name = split_up_string_array[0] Set acct_num = split_up_string_array[1] Set site_code = split_up_string_array[2]
Anthony Holloway
Please use the star ratings to help drive great content to the top of searches.
ā08-05-2013 09:41 AM
Thanks Anthony for your support.
ā08-05-2013 09:49 AM
No worries. I'm happy to help.
Anthony Holloway
Please use the star ratings to help drive great content to the top of searches.
ā11-09-2016 06:40 AM
Hi Anthony,
if I have a string contains a number of 6 digits .. for example: 123560 and I want to split it into two strings - 1 for thousands numbers and 2 for hundreds numbers.
original string: 123560
output string 1: 123
output string 2: 560
how can I do it?
Regards
Ahmad
ā04-17-2015 07:31 AM
Easy and simple.
Wasted about 2 hours to split array, your post helped me.
ā04-17-2015 08:39 AM
That's awesome to hear. I don't post as much as I use to, but it's nice to see that my older contributions are still helping people solve problems.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide