cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1345
Views
0
Helpful
6
Replies

CCX Variable with White Space

I am pulling info from an XML document, then creating a variable, which should just be a series of digits.  The database has put white spaces in front or behind the digits, I need to delete the white space and just have the digits.  Any suggestions?

 

System version: 11.6.1.10000-51

CCX Premium

1 Accepted Solution

Accepted Solutions

arcaidy
Level 1
Level 1

You could do it this way.

1. Create an IF to check for a leading space

2. Use trim in a SET to remove all white space if found
You could use the SET and trim step by itself and do the same thing without the IF. I like the IF in front of it.

 

Script.JPGIF.JPGset.JPG

Thanks,
James Coffey

View solution in original post

6 Replies 6

Jonathan Schulenberg
Hall of Fame
Hall of Fame
Welcome to RegEx. You can use a little Java code snippet to find the whitespace characters and replace them with nothing.
https://www.javamex.com/tutorials/regular_expressions/search_replace.shtml

I am looking for triming out white space in front and behind the variable.  The number of white spaces are unknown.  I don't see this ability with Regex.

Well that’s how you do it. I suggest studying RegEx and perhaps searching Google a bit. Logic along the lines of finding all non-whitespace characters, wrapping them in a character group, and using that as the replacement. Or, if you preferred to find leading whitepsace characters, remove them, and check again at the end of the string.

I will have to work a bit on my Regex Skills, I am pretty good in the router with them but have not used any in CCX.  My biggest challenge using Regex was finding the correct formula for finding unknown number of white spaces.  All my experience with Regex is with known numbers.  Thanks!

arcaidy
Level 1
Level 1

You could do it this way.

1. Create an IF to check for a leading space

2. Use trim in a SET to remove all white space if found
You could use the SET and trim step by itself and do the same thing without the IF. I like the IF in front of it.

 

Script.JPGIF.JPGset.JPG

Thanks,
James Coffey

Worked perfect, Thanks!!