Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 11661

How to remove duplicate https:// in URL - Flutter Dart

$
0
0

How to remove duplicate https:// if present in URL more than once

For example if input is "https://https://example.com"

the output should be "https://example.com"

I tried this but it didn't remove the duplicate https:// from url

  void removeDuplicateHttps(String url) {    String cleanedUrl = url.replaceAll(RegExp(r'https://+'), 'https://');    setState(() {      linkUrlController.text = cleanedUrl;    });  }

Viewing all articles
Browse latest Browse all 11661

Trending Articles