Skip to content

Commit 43e6064

Browse files
ulleniusJohannestegner
authored andcommitted
Override toString method
1 parent 32a0101 commit 43e6064

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/dev/personnummer/Personnummer.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ public Personnummer(String personnummer) throws PersonnummerException {
161161
this(personnummer, new Options());
162162
}
163163

164+
@Override
165+
public String toString() {
166+
return format();
167+
}
168+
164169
/**
165170
* Format the personal identity number into a valid string (YYMMDD-/+XXXX)
166171
* If longFormat is true, it will include the century (YYYYMMDD-/+XXXX)
@@ -234,6 +239,5 @@ public boolean equals(Object obj) {
234239
return Objects.equals(format(true), other.format(true));
235240
}
236241

237-
238242

239243
}

0 commit comments

Comments
 (0)