fix(studylist) Fix DICOM Patient Name formatting (#35)

This commit is contained in:
Erik Ziegler 2018-06-13 16:43:53 +02:00
parent 781f6039fa
commit 2c790ff674

View File

@ -7,7 +7,15 @@ const formatPN = context => {
return;
}
return context.replace('^', ', ');
// Convert the first ^ to a ', '. String.replace() only affects
// the first appearance of the character.
const commaBetweenFirstAndLast = context.replace('^', ', ');
// Replace any remaining '^' characters with spaces
const cleaned = commaBetweenFirstAndLast.replace(/\^/g, ' ');
// Trim any extraneous whitespace
return cleaned.trim();
};
/**