Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

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;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #convert #python #code
ADD COMMENT
Topic
Name
9+6 =