Answers for "How to i convert this python code to dart?"

0

How to i convert this python code to dart?

void main() {
  print(strip(strip(strip(strip(strip(" [(,'Sample String',)] ", " "), "[]"), "()"), ","), "''"));
  //Output: "Sample String"
}

String strip(String string, String char)
{  
  string = (string.startsWith(char[0]) && string.endsWith(char[char.length - 1])) 
  ? (){string = string.substring(1);
    string = string.substring(0, string.length - 1); return string;}() 
  : string;

  return string;
}
Posted by: Guest on July-24-2021

Code answers related to "How to i convert this python code to dart?"

Code answers related to "Dart"

Browse Popular Code Answers by Language