0
Java scan using offset
How can I scan a set of characters on a card which includes a particular word, but after scanning it omits this particular and returns the other characters. For example, on the card or image there is IJN 173648493637 but I want to scan only the numbers in these characters. The code selects characters that have IJN because there are a whole lot of strings and characters. NB: the numbers will differ in other images.
3 ответов
+ 2
Just an idea, save the scanned input as an array, then only use chars from index 2 on?
+ 1
if there is space between and number is String in result
import java.util.Scanner;
...
String str = "IJN 173648493637";
Scanner sc = new Scanner(str);
sc.next();
String numstr = sc.next();
System.out.println( numstr ); // 173648493637
0
Just an idea, save the scanned input as an array, then only use chars from index 2 on?
Thanks 🔥