Java scan using offset | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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.

4th Jul 2019, 12:57 PM
Dag-Emmanuel Ankrah
Dag-Emmanuel Ankrah - avatar
3 Answers
+ 2
Just an idea, save the scanned input as an array, then only use chars from index 2 on?
4th Jul 2019, 1:01 PM
HNNX 🐿
HNNX 🐿 - avatar
+ 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
4th Jul 2019, 1:45 PM
zemiak
0
Just an idea, save the scanned input as an array, then only use chars from index 2 on? Thanks 🔥
4th Jul 2019, 1:05 PM
Dag-Emmanuel Ankrah
Dag-Emmanuel Ankrah - avatar