Tips&Tricks – Capitalizing 1st Letter of Every Word

20 May

It was asked how you could capitalize 1st letter of every word in a sentence.

Below is a procedure that can take any sentence and will capitalize first letter of every word. For this, I have created a procedure-with-return called “capitalize”. The procedure accepts an argument “text”, performs some functions and then returns a result. This means we can invoke the procedure and pass it some Text data, and then expect it to return a result. When invoked, the “capitalize” procedure

  1. Initializes a global variable “varTemp”
  2. It then uses the “split at spaces” block to split the Text into pieces separated by spaces (i.e. splits into words). Once split, it will assign the List to “item” variable
  3. Next, we use a for-each block to loop through the newly created list of words. For each word,
    1. Using “segment” we extract 1st letter of the word and convert it to upper case
    2. Using “segment” we extract rest of the word starting 2nd position
    3. We join (i.e. concatenate) varTemp (see 1)  + 3.i + 3.ii and add a blank space to the end
  4.  Once the loop is completed, we use “trim” to get rid of last blank space and then return the result to the caller





Update above procedure to use local-variable instead of global. For purpose of tutorial, to keep blocks presentation simpler, global variable was used. Try to use a local-variable for the procedure.


Mobile App Development


Posted by on May 20, 2014 in Uncategorized


4 responses to “Tips&Tricks – Capitalizing 1st Letter of Every Word

  1. Timothy Fox

    September 15, 2016 at 1:10 pm

    Excellent tutorial. Could you please show an updated version of this? The latest version of AI2 doesn’t have the ‘text’ variable included in the procedure block. Would you use a global variable in its place? I’m trying to update the tinydb tutorial and force a capital letter for the entry so when its alphabetized i wont have ABCabc.

    Thanks again

    • Hossein Amerkashi

      September 15, 2016 at 1:36 pm

      The “text” is an argument in a procedure. I have that changed from its default name to “text”

      • Tim fox

        September 16, 2016 at 8:32 pm

        Got it figured out. But It throws an error every time. of ‘cant start with 0 +1 +1..(I believe its because I start with a fresh database-empty the cache). I used the capitalize result block with only the join, and all blocks connected to join, It will capitalize the first word as it should without throwing an error. But im trying to add in the for each in the list and trim with some difficulty. Any ideas? Im using the TinyDB tutorial as the base until I get the blocks worked out.

    • Hossein Amerkashi

      September 16, 2016 at 8:35 pm

      You can post question to AppyBuilder forum HERE
      You may also want to consider getting AppyBuilder SILVER plan here:


Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: