MCPcopy Create free account
hub / github.com/ZsBT/mrz-java / toPos

Method toPos

src/main/java/com/innovatrics/mrz/Demo.java:35–52  ·  view source on GitHub ↗
(int col, int row, String text)

Source from the content-addressed store, hash-verified

33public class Demo {
34
35 private static int toPos(int col, int row, String text) {
36 int currentRow = 0;
37 int currentCol = 0;
38 int pos = 0;
39 while (text.length() > pos) {
40 if (row == currentRow && currentCol == col) {
41 return pos;
42 }
43 if (text.charAt(pos) == '\n') {
44 currentRow++;
45 currentCol = 0;
46 } else {
47 currentCol++;
48 }
49 pos++;
50 }
51 return -1;
52 }
53
54 /**
55 * MRZ demo.

Callers 1

actionPerformedMethod · 0.95

Calls 1

lengthMethod · 0.80

Tested by

no test coverage detected