Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement zeroPad string provider #122

Open
DavidUnderdown opened this issue May 18, 2016 · 0 comments
Open

Implement zeroPad string provider #122

DavidUnderdown opened this issue May 18, 2016 · 0 comments
Milestone

Comments

@DavidUnderdown
Copy link

DavidUnderdown commented May 18, 2016

In the case of our digitisation project, the file_path includes a zero-padded running number (aka ordinal) for the image files within a piece or item. Using concat within starts and ends expressions, plus some regex allows fairly tight validation of the fact the file_path has been built up as expected eg

file_path: starts(concat("file:///",$department,"",$series,"/",$piece,"/",$item,"/",$piece,"",$item,"")) and regex("^.*[0-9]{1,4}.jp2$") and ends(concat($ordinal,".jp2"))

but there is still a small chance that there might be some digit other than zeroes before the ordinal at the end of filename (before the jp2 extension).

if we had a zero padding expression, something like zeroPad($ordinal,4) would return a string provider padded with leading zeroes sufficient to make the string 4 characters long, eg zeroPad(5,4) would produce 0005 while zeroPad(10,4) would give 0010 and zeroPad(104,4) would give 0104.

A full validation of the file_path might then look like:

file_path: starts(concat("file:///",$department,"",$series,"/",$piece,"/",$item,"/",$piece,"",$item,"_",zeroPad($ordinal,4),".jp2"))

@DavidUnderdown DavidUnderdown added this to the 1.2 milestone May 18, 2016
@DavidUnderdown DavidUnderdown changed the title zeroPad string provider Implement zeroPad string provider May 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant