import be.nikiroo.jvcard.parsers.Format;
import be.nikiroo.jvcard.parsers.Parser;
-import be.nikiroo.jvcard.tui.StringUtils;
+import be.nikiroo.jvcard.resources.StringUtils;
/**
* A contact is the information that represent a contact person or organisation.
for (Data data : getData(name)) {
if (first == null)
first = data;
- for (int index = 0; index < data.size(); index++) {
- TypeInfo type = data.get(index);
- if (type.getName().equals("TYPE")
- && type.getValue().equals("pref")) {
- return data;
- }
- }
+
+ if (data.isPreferred())
+ return data;
}
return first;
*/
public String toString(Format format, int startingBKey) {
updateBKeys(false);
- return Parser.toString(this, format, startingBKey);
+
+ StringBuilder builder = new StringBuilder();
+ for (String line : Parser.toStrings(this, format, startingBKey)) {
+ builder.append(line);
+ builder.append("\r\n");
+ }
+
+ return builder.toString();
}
/**
@Override
public String getState() {
- return "" + getPreferredDataValue("UID");
+ return getId();
}
/**