Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 nigharikkha
		
			nigharikkha
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi all,
I am using Replace() in load script to replace certain substrings. However, I am facing the following difficulty.
Field values: 'PRE1','PRE2','PRE3','PRE4','PRE5','PRE6','PRE7','PRE8','PRE9','PRE10','PRE11','PRE12','PRE13','PRE14','PRE15'
I need the following replacements:
PRE1 --> PRE01
PRE2 --> PRE02..... and so on until PRE9 --> PRE09.
If I use replace function, the strings PRE10 and PRE20 are converted into PRE010 and PRE020.
Can you please help in this so that only the exact value are getting replaced and not substring?
 
					
				
		
 marcus_sommer
		
			marcus_sommer
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		You may use something like this:
purgechar(Field, '0123456789') & num(keepchar(Field, '0123456789'), '00') as Field
- Marcus
 James5654
		
			James5654
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		The JavaScript String replace() method returns a new string with a substring ( substr ) replaced by a new one ( newSubstr ). Note that the replace() method doesn't change the original string. It returns a new string.
 
					
				
		
 marcus_sommer
		
			marcus_sommer
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		You may use something like this:
purgechar(Field, '0123456789') & num(keepchar(Field, '0123456789'), '00') as Field
- Marcus
 nigharikkha
		
			nigharikkha
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Thanks @marcus_sommer . That is an intelligent way to handle. It works perfectly!!
