Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.FileWriter;
- import java.io.FileInputStream;
- import java.io.IOException;
- import java.util.Scanner;
- public class Main {
- static void characterInsertion(byte[] Str) {
- char[] cons = {'E','e', 'U','u','I','i','O','o','A','a'};
- StringBuffer str = new StringBuffer(String.valueOf(Str));
- for (int i = 0 ; i < str.length(); i++){
- if ( str[i] == cons[i]) {
- str.insert(str[i], "*");
- }
- }
- }
- private static int currentIndex = -1;
- private static Integer next(String numbers[]) {
- ++currentIndex;
- while (currentIndex < numbers.length
- && numbers[currentIndex].equals(""))
- ++currentIndex;
- return currentIndex < numbers.length ?
- Integer.parseInt(numbers[currentIndex]) :
- null;
- }
- static void saveFile(byte Str ) throws IOException {
- Scanner in = new Scanner(System.in);
- String outputFileName;
- System.out.println("Введите имя файла в который хотите вывести данные:");
- outputFileName = in.nextLine();
- FileWriter out = new FileWriter(outputFileName);
- out.write("\n Новая строка : " + Str );
- out.close();
- }
- public static void main(String[] args) throws IOException {
- String NameOfFile;
- Scanner in = new Scanner(System.in);
- FileInputStream inFile = new FileInputStream("C:\\Users\\Asus\\Desktop\\fxujk.txt");
- byte[] str = new byte[inFile.available()];
- inFile.read(str);
- String text = new String(str);
- String[] numbers = text.split("\\C");
- int n = next(numbers);
- byte Str;
- inFile.close();
- Str = characterInsertion(str);
- saveFile(Str);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement