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

Popular posts from this blog

Write a Dart program to convert from celsius degrees to Kelvin and Fahrenheit.

Write a Dart program to check two given integers and return true if one is negative and one is positive

Write a Dart program to compute the sum of two given integers, if two values are equal then return the triple of their sum