NumberToCharacter AZ


NumberToCharacter AZ

This node takes an integer as input.

Returns the “alphabetical equivalent character”,  and a list from A to the alphabetical equivalent character.

It only works from 1 to 26 (A to Z). [See NumberToCharacter AAZZ for higher inputs]

After this, returns a “Out of range” message.

NumberToCharacter AZ_working

The node uses DesignScript to work:

NumberToCharacter AZ_inside

There is a local variable, “a”, which is an alphabetical list.

The input, named index in the code block,  is evaluated to see if it’s less or equal than “a” count:

index<=List.Count(a). This is passed into a formula node as the “Test input”.

If it’s true, then, it retrieves the index, less one, in the alphabet’s list. We subtract one unit because we want to make our input “one based”, instead of “zero based”. 1 will equal to A.

If it’s false, the string “Out of range” is passed to the output node.

For the second output, a new list called “b” is defined. Starting with “a” list, it is “choped” in two lists, been the input the chopping point.

The last step is getting the first list, so a” b[0]” is used and passed to the second output. This second output is also connected to te “Out of Range” string if the condition is not true.

 

Advertisements

One thought on “NumberToCharacter AZ

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s