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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
intervigilium
Contributor III
Contributor III

Split if string contains a specific character

Hi all,

I have a simple question, find the solution everywhere on the forum... but not working in my case (strange enough). What am i doing wrong?

I have a field with the name "Fumberfield". It contains string with 11 digits.
Value is 11 numbers with or without a '*' .

For example 123456*7890 or 12234567890

If there is a * in the string, i want to seperate it in 2 subfields with a length of 5 en 6 digits.
So the * is NOT the delimiter (otherwise it would be easier).

Now i load a table with the field and added the following in the script:

If(WildMatch(Numberfield, '*'), 'FOUND *', ' * NOT FOUND') as NewNumberfield,

If working, i will replace the FOUND by a Left and Right). But it is not working (says it is found even there is no * in the string.

Anyone a idea? Also tried '***' as  extra wildcards because it is in de middle of the string.

ps: if i use a digit 5 as test instead of * , it is also not working....

Thanks in advance.

1 Solution

Accepted Solutions
marcus_sommer

I think the identifying if there is a * and where could be easier done with:

substringcount('123456*7890', '*') and index('123456*7890', '*')

- Marcus

View solution in original post

2 Replies
marcus_sommer

I think the identifying if there is a * and where could be easier done with:

substringcount('123456*7890', '*') and index('123456*7890', '*')

- Marcus

intervigilium
Contributor III
Contributor III
Author

Thanks,!  It worked instantly 🙂