package com.shrimpking.t4;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
/**
* Created by IntelliJ IDEA.
*
* @Author : Shrimpking
* @create 2024/9/22 20:48
*/
public class InputLineDemo
{
public static void main(String[] args) throws FileNotFoundException
{
File inputFile = new File("d:\\test\\share.txt");
Scanner in = new Scanner(inputFile);
while (in.hasNextLine())
{
String line = in.nextLine();
int i = 0;
while (Character.isDigit(line.charAt(i)) == false)
{
i++;
}
String shareName = line.substring(0, i);
String shareValue = line.substring(i);
double share = Double.parseDouble(shareValue);
System.out.printf("%s\t:\t%-10.4f%n", shareName, share);
}
in.close();
}
}