Write a Dart program remove specified a character from a non-empty string using index of a character.
Code:
import 'dart:io';
void main() {
stdout.write('Input word : ');
String word = stdin.readLineSync();
stdout.write('index to be removed : ');
int index = int.parse(stdin.readLineSync());
word = word.substring(0, index) + word.substring(index + 1);
print(word);
}
Output:
Comments
Post a Comment