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.
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: