cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3603
Views
25
Helpful
6
Replies

splitting a string variable in UCCX

Muhammad Usman
Level 1
Level 1

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

1 Accepted Solution

Accepted Solutions

Anthony Holloway
Cisco Employee
Cisco Employee

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.

View solution in original post

6 Replies 6

Anthony Holloway
Cisco Employee
Cisco Employee

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.

Thanks Anthony for your support.

No worries.  I'm happy to help.

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.

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

Easy and simple.

Wasted about 2 hours to split array, your post helped me.

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.

Getting Started

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: