Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I need to find out this substring
'abc'
from a text which is like this
'qwe','wer','abc'.
Is it possible using substringcount?
I am asking becasue the there are single quotes in the main text 'qwe','wer','abc' so substringcount does not recognize it as a single text in its 1st param.
You can try this way by replace comma with blanks just for finding the "abc" string in column.
LOAD *,If(NewStrData > 0,'Found','NotFound') as abcFoundflag;
LOAD *,FindOneOf(replace(StrData,chr(39),''),'abc') as NewStrData;
load * Inline
[
StrData
"'qwe','wer','abc'"
"'qwe','ret'"
];
Hi,
Have you tried
SubstringCount() returns the number of occurrences of the specified substring in the input string text. If there is no match, 0 is returned.
SubStringCount( text , substring)
SubStringCount(Field,Chr(39)&'abc'&Chr(39))
please post some more examples and your expected result.
thanks
regards
Marco
Alternatively, you may decide to remove/replace the single quotation marks from the Source string (but leave the comma).
S.
for this try subfield function to get a part of text from a string
SubField(text, delimiter[, field_no ])
subfield('qwe','wer','abc',',',3)
Hi,
maybe this example helps you to describe what different result you would expect of the SubStringCount() function:
table1:
LOAD *,
SubStringCount(text,substring) as SubstrCnt
Inline [
text, substring
"'qwe','wer','abc'" , "'abc'"
"'qwe','wer','abc'" , abc
"'qwe','wer', abc" , "'abc'"
"'qwe','wer', abc" , abc
"'qwe','abc','wer','abc'" , "'abc'"
"'qwe','abc','wer','abc'" , abc
];
hope this helps
regards
Marco
Hi Jean,
If you have found answer to your question then please close the thread.
I have to do it in the expression.