1

I am trying to implement a condition in my code :

let isShow : boolean;
const myString = 'gclid';
isShow = this.router.url.startsWith('?'+ myString +'=');

Now, the condition is that if in URL, it contains 'gclid' but its UpperCase like "GCLID" or it contains 'gclid' but any of the letter in URL substring is UpperCase like 'gClid', then it will return 'false'.

But according to requirement, it should return true if the url contains 'gclid' with ignoring Case.

Please suggest, if its possible, I have tried some workarounds, but till now not getting what's expected. Your help will be highly appreciable.

Thanks !

0

1 Answer 1

3

Convert the string to lower case and then you can check if it is present in the url:

let show = this.router.url.toLocaleLowerCase().contains('gclid');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.