Editorial Workflows

Add up Measurements

public workflow

Install Workflow...

This workflow contains at least one Python script. Only use it if you trust the person who shared this with you, and if you know exactly what it does.

I understand, install the workflow!

This is a workflow for Editorial, a Markdown and plain text editor for iOS. To download it, you need to view this page on a device that has the app installed.

Description: When a list of measurements in feet and inch is selected, e.g. 5' 6" 3' 8", it's replaced with its sum (9' 2" in the example).

(Response to this forum post: http://omz-forums.appspot.com/editorial/post/5810838858366976 )

Shared by: @olemoritz

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Run Python Script ?
Source Code
import editor
import re

def main():
	text = editor.get_selected_text()
	feet = sum(int(x) for x in re.findall(r"(\d+)'", text))
	inches = sum(int(x) for x in re.findall(r'(\d+)"', text))
	if not (feet or inches):
		return
	feet += (inches / 12)
	inches %= 12
	replacement = '%i\' %i"' % (feet, inches)
	start, end = editor.get_selection()
	editor.replace_text(start, end, replacement)

main()