Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'dart:io';
- import 'package:okay/okay.dart';
- void main(List <String> args){
- if (args.length!=2){
- print("please provide valid inputs!");
- return;
- }
- final input = File(args[1]);
- if (!input.existsSync()){
- print("please create the input file!");
- }
- try{
- String inputcontent = input.readAsStringSync();
- String modifiedcontent = modify(inputcontent);
- input.writeAsStringSync(modifiedcontent);
- } catch(e){
- print("oops!");
- }
- return ;
- }
- String modify(String s){
- final lines = s.split('\n');
- List<String> keywords = [];
- for (String line in lines){
- List words = line.split(' ');
- for (String word in words){
- keywords.add(word);
- keywords.add(word);
- }
- }
- final m = keywords.join('\n');
- return m;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement