Friday, December 4, 2020
Home YOUTUBE VIDEOS Video: Ways Of Styling Texts In Programming

Video: Ways Of Styling Texts In Programming


In my previous video, I have talked about how to add text in programming . In this video, I want to talk about styling text in programming. Follow me as we will look at that in this article.


Styling texts in programming

We now have the ability to add text to other pieces of text. But what if we want to change or remove certain characters from a piece of text? For example, let’s say we want to prompt a user for their favorite drink and then print “(userName) wants a (drink).” In this example, if our user inputs “WATER,” our output will be “(userName) wants a WATER” which would be incorrect. How can we fix this?

We can use the to upper case block to switch the letter case of a piece of text.


But, if we add “water” as the value of the upper case block, it will be changed to “WATER”. This is the opposite of what we want. To change from “WATER” to “water”, we need to change the letter case to lower case. By opening the drop down menu, we can switch between the different letter cases.


Now, we can properly ensure that our user input’s drink is stylized to the right case, so let’s try it! Create two input prompts with the prompt for text with message block from previous modules. One should ask the user “What is your name?” and the other should ask “What is your favorite drink?” You should also create two variables, userName and myDrink, to store the inputs.

Once you’ve created the input prompts and variables, use the lower case block to fix the value of myDrink. Attach the input prompt for myDrink to the to lower case block and then attach both to the set variable to block in order to store it.


READ THIS  How To Append Text In Programming Jobs
READ THIS  Video: Understanding The Stage In Programming

Additionally, we can use the title case option from the drop down menu to ensure that the user’s name is properly capitalized. Title case will capitalize only the first letter of each word in a piece of text. We can use this to only capitalize the first letter of our user’s name the same way we fixed the capitalization for myDrink. Now our output should have proper capitalizations.

However, there is still one potential issue with our user’s input. For both userName and myDrink, the user may input text with a large number of spaces before or after their input (eg. “     water     ”). To fix this, we can use the trim spaces block.


This block will allow us to get rid of excess spaces on either side of a piece of text. The drop down menu will allow us to switch between removing spaces from the left sideright side, or both sides.


For the purposes of cleaning up our user’s inputs, we should remove spaces from both sides of userName and myDrink. Add a trim spaces block in between the set variable and letter case blocks for both variables.

If we now use a print block and a create text with block, we can print out “(userName) wants a (drink).” with the proper capitalization and spacing, regardless of user error.


Now your take on this article…

I know you might agree with some of the points that I have raised in this article. You might not agree with some of the issues raised. Let me know your views about the topic discussed. We will appreciate it if you can drop your comment. Thanks in anticipation.


READ THIS  Video: How The Change A Variable's Value
READ THIS  Videos: How To Bring Project To an End


Become Part Of our Fan Base on Facebook. Click Here.

Follow Us on twitter. Click Here.

Download Our App. Click Here
Many Crypto. One place. Use Roqqu




Adeniyi Salau
I am an IT entusiast and a man of many parts. I am a Certified Digital Marketer, Project Manager and a Real Estate Consultant. I love writing because that what keeps me going. I am running this blog to share what I know with others.

Most Popular

Common Mistakes You Are Making in PPC Campaigns

Common Mistakes You Are Making in PPC Campaigns   Pay-Per-Click (PPC) is a type of marketing that falls under online advertising. Here, advertisers accrue costs when...

Highlighting Major Components Of Website Design

Highlighting Major Components Of Website Design     There are many people that have come up with their own ideas of what they feel it's important when...

5 Steps To Deploy A Successful Content Marketing Strategy

5 Steps To Deploy A Successful Content Marketing Strategy   A customer-centric content marketing strategy delivers qualitative content to meet the needs of consumers who educate...

Differences Between Website Optimization And SEO

Differences Between Website Optimization And SEO       Website optimization: deals more with the user experience and making the website easier to use. Examples include website layout,...