Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
lmit
Creator II
Creator II

substring in a string

Hi All,

 

I have a input data which has a special character  like

 

"maths*science*English"

 

my ouput should have data like

science

English

 

the position of the special character is not fixed and I should consider the occurrence of special character based on the other column i.e., if the other column has data like 3 I should consider the 3rd occurrence of the special character.

 

 

Thanks in Advance,

Lmit 

 

 

 

Labels (2)
10 Replies
akumar2301
Specialist II
Specialist II

Another simple solution 

 

Input  -- tjavarow -- Output

 

input

id,newColumn,pos

1,abc*dfec*eng,1
2, abc*dfec*eng*math,3

tjavarow 

 

output_row.id = input_row.id;

try {
output_row.result = input_row.newColumn.split("\\*")[input_row.pos];

}
catch ( Exception e ){
output_row.result = "Err - Not found";
}

 

Output 

id|result

1|dfec
2|math