You are reading the article How To Use Isblank With Examples updated in December 2023 on the website Kientrucdochoi.com. We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested January 2024 How To Use Isblank With Examples
ISBLANK FunctionChecks if a specified cell is blank or not
Written by
CFI Team
Published July 2, 2023
Updated July 7, 2023
What is Excel ISBLANK Function?The ISBLANK Function[1] is an Excel Information function that returns true if the argument cell has no information in it. ISBLANK checks a specified cell and tells us if it is blank or not. If it is blank, it will return TRUE; else, it will return FALSE. The function was introduced in MS Excel 2007.
In financial analysis, we deal with data all the time. The ISBLANK function is useful in checking if a cell is blank or not. For example, if A5 contains a formula that returns an empty string “” as a result, the function will return FALSE. Thus, it helps in removing both regular and non-breaking space characters.
However, if a cell contains good data, as well as non-breaking spaces, it is possible to remove the non-breaking spaces from the data.
Formula=ISBLANK(value)
Where:
Value (required argument) is the value that we wish to test. (This function takes in a cell)
How to use the Excel ISBLANK FunctionAs a worksheet function, ISBLANK can be entered as part of a formula in a cell of a worksheet. To understand the uses of this function, let us consider a few examples:
Highlight Missing Values – ExampleSuppose we are given the following data:
Suppose we wish to highlight cells that are empty. We can use the ISBLANK coupled with conditional formatting. For example, suppose we want to highlight the blank cells in the range A2:F9, we select the range and use a conditional formatting rule with the following formula: =ISBLANK(A2:F9).
How to do conditional formatting?The input formula is shown below:
We will get the results below.
Conditional formatting didn’t highlight cell E5. After checking, there is a formula inserted into the cell.
The Excel ISBLANK function will return TRUE when a cell is actually empty. If a cell is an empty string (“”), ISBLANK will return FALSE, as it is not technically blank, and it won’t be highlighted as shown above.
Extracting the first NON-Blank value in an arraySuppose we wish to get the first non-blank value (text or number) in a one-row range. We can use an array formula based on the INDEX, MATCH, and ISBLANK functions.
We are given the data below:
Here, we want to get the first non-blank cell, but we don’t have a direct way to do that in Excel. We could use VLOOKUP with a wildcard *, but that will only work for text, not numbers.
Hence, we need to build the functionality by nesting formulas. One way to do it is to use an array function that “tests” cells and returns an array of TRUE/FALSE values that we can then match with MATCH. Now MATCH looks for FALSE inside the array and returns the position of the first match found, which, in this case, is 2. Now the INDEX function takes over and gets the value at position 2 in the array, which, in this case, is the value PEACHES.
As this is an array formula, we need to enter it with CTRL+SHIFT+ENTER.
We get the results below:
Additional ResourcesThanks for reading CFI’s guide to important Excel functions! By taking the time to learn and master these functions, you’ll significantly speed up your financial modeling and valuation analysis. To learn more, check out these additional CFI resources:
You're reading How To Use Isblank With Examples
How To Use Object In Excel Vba With Examples?
VBA Object
In Microsoft Excel, a VBA Object can contain one or more than one object. Such as a single workbook can have one or more than one worksheet. Workbook, Worksheet, Range, and cells are the objects in Excel. Each object has its own properties. And they all have a different method of application. Let say the workbook is the main object which has 2 worksheets in it. Those 2 worksheets will be its child object. One of the sheets has one range, so that sheet will become the main object, and the range will be its child object.
Watch our Demo Courses and Videos
Valuation, Hadoop, Excel, Mobile Apps, Web Development & many more.
How to Use Object in VBALet’s see the examples of object in Excel VBA.
You can download this VBA Object Excel Template here – VBA Object Excel Template
Example #1 – VBA ObjectIt can be written in many ways. Suppose we need to print any text in a cell, so this can be done in various ways. We can directly use the range value to that cell. This direct method is not a part of VBA Object but a process of performing a task that could be done by VBA Object as well. For this:
Step 1: Go to VBA and insert a Module from the Insert menu option as shown below.
Step 2: Now write the Sub Category of performed function, like VBA Object, in any other name as per your choice, as shown below.
Sub
VBAObject2()End Sub
Step 3: Now select the range function considering any cell, let’s say cell B3 with Value as shown below.
Code:
Sub
VBAObject2() Range("B3").Value =End Sub
Step 4: Now add text or word in that range cell as shown below.
Code:
Sub
VBAObject2() Range("B3").Value = "VBA Object"End Sub
Step 5: Now, compile the code and run it by pressing the play button located below the menu bar.
Example #2 – VBA ObjectThis is the normal way of printing text to any cell. How we will see how the same process can be done when we use VBA Object. For this, we will need another fresh module. And in that,
Step 1: Go to VBA and insert a Module from the Insert menu option as shown below.
Step 2: Write the Sub Category of VBA Object as shown below.
Code:
Sub
VBAObject1()End Sub
Step 3: Here, we will see the complete VBA Object from the main to a child category. First, select the currently opened workbook with the help of the command ThisWorkBook with Application, as shown below. This will select the workbook which is actually opened and last selected.
Code:
Sub
VBAObject1() Application.ThisWorkbookEnd Sub
Step 4: Now select the sheet which is currently opened in the workbook, or we can write the name of the worksheet as well. Here, we have written the name of sheet Sheet1 in inverted commas, as shown below.
Code:
Sub
VBAObject1() Application.ThisWorkbook.Sheets ("Sheet1")End Sub
Step 5: Now comes the range. Select the range of the cell where we need to print or insert the text. Here we are selecting cell B4, as shown below.
Code:
Sub
VBAObject1() Application.ThisWorkbook.Sheets("Sheet1").Range("B4").ValueEnd Sub
Code:
Sub
VBAObject1() Application.ThisWorkbook.Sheets("Sheet1").Range("B4").Value = "VBA Object"End Sub
Step 7: Now, compile and run the code. We will see cell B4 has the text “VBA Object”.
This complete process is called VBA Object. In which we have first selected the main object, i.e. Workbook, which has its child object, i.e. Sheet1, and that has another child object range, i.e. cell B4.
Example #3 – VBA ObjectThere are many different ways to add text to any cell. One can be with Excel VBA Object, and others can be without it. In these categories, again, there are many ways to do it. Let’s see another way to add VBA Object. For this, we will need a module.
Step 1: In that module, add a subcategory; better make it with sequence number as shown below.
Code:
Sub
VBAObject3()End Sub
Step 2: Select the worksheet by adding the name of the current worksheet, which is Sheet1, as shown below.
Code:
Sub
VBAObject3() Worksheets("Sheet1").End Sub
Step 3: Now, add the range of the cell where we want to see the output, as shown below.
Code:
Sub
VBAObject3() Worksheets("Sheet1").Range("A3").ValueEnd Sub
Step 4: At last, give it a value that we can see once we run the code. We are considering the same text as seen in example 1.
Sub
VBAObject3() Worksheets("Sheet1").Range("A3").Value = "VBA Object"End Sub
Step 5: Now run the code. We will see; cell A3 got the text which we wanted to add there, as shown below.
In this process, we have directly added the worksheet. So Worksheet will become our Object, and Range will become its child object.
Step 6: There is another way to perform the same task. In the bracket of the worksheet, instead of writing the sheet name, we can write the sequence of the sheet, which is 1, as shown below.
Code:
Sub
VBAObject3()'
Worksheets("Sheet1").Range("A3").Value = "VBA Object"
Worksheets(1).Range("B3").Value = "VBA Object"End Sub
Step 7: Now run the modified code. We will see cell B3 got the same text VBA Object as cell A3, as shown below.
By keeping both the code in line, we can see and compare the changes we made. In another way,
Step 8: Instead of the Worksheet function, if we use the Sheet with sequence and selecting cell C3 as range as shown below.
Code:
Sub
VBAObject3()'Worksheets("Sheet1").Range("A3").Value = "VBA Object"
'Worksheets(1).Range("B3").Value = "VBA Object"
Sheet1.Range("C3").Value = "VBA Object"End Sub
Step 9: Now run this code. We will see, again the same text will get added in range cell C3.
In all the methods which we have seen in this example, Worksheet is our object, and the range of the cell is child object or Sub-object.
Pros and Cons of Excel VBA Object
We can make as many objects and link them together to sink them.
It makes use of Workbook, Sheet, and Range easy.
This allows a user to make changes in a specific Workbook, Worksheet or Range.
The same process can be performed by a much shorter code with having the same result.
Things to Remember
Worksheet and Sheet both have the same use.
We can select any worksheet of the same workbook of any number sequence.
While writing big lines of code, it is important to form an Object in which the Workbook, Worksheets, and Ranges of different cells are linked.
Must save the file in Macro-Enabled Excel format. It allows us to use the code and change the code whenever required.
Recommended ArticlesThis is a guide to VBA Object. Here we discuss how to use Object in Excel VBA along with practical examples and downloadable excel template. You can also go through our other suggested articles –
Guide To How Ansible Debug Work With Examples
Introduction to Ansible Debug
In Ansible, when we create and run playbooks, it’s very common that we run into an error due to some issues with our playbook. This can be a syntax error, a logical error or some mandatory parameter is missing. So, this is very important that we should always write our playbook in such have a way that it always prints enough information, be it successful or failure. In Ansible, a module named debug is the requirement when you need to debug and when you need more information in playbook execution output.
Start Your Free Software Development Course
Web development, programming languages, Software testing & others
In this article we will try to learn some concepts and see Ansible debug examples. This is a default module that comes with Ansible package. This module prints statements and variable’s values when executing playbooks. This can be very helpful in cases, where you can skip some erratic tasks in the playbook and don’t want to stop it altogether. Using debug in all the erratic tasks, will provide you enough information about the data execution in those tasks and all variables used in such tasks. This will help in troubleshooting and is very useful if you use it with registered variables. We will explore such cases in the example section.
How do Ansible Debug works?In Ansible debug module comes with some parameters and these parameters accept some options. This is given below:
msg: – This parameter accepts strings as inputs. This is used to print a customized message. If no message is given, then a generic message like “Hello World!” is
var: – This accepts strings as input and this is the variable that has been set either by Ansible facts or by the playbook. Also, the values written here will be having implicit double interpolation, as this option runs in the jinja2 context. So, you don’t need to use jinja2 delimiter unless you want to print double interpolation as well. You can use double interpolation when you print a variable in a
verbosity: – This has default as 0. This parameter is used to control when debug is in a run. For example if value 3 is given then debug will only run if -v or above is given while running the playbook.
Examples to Implement Ansible DebugNow we will take some examples, but before going there, we first understand our lab used for testing purposes. Here we have an Ansible control server named ansible-controller and two remotes hosts named host- one and host-two. We will create playbooks and run Ansible commands on the ansible-controller node and manage the users on remote hosts.
Examples #1To print a default message on the output of running a playbook via ansible-playbook, we can create a simple playbook like below:
Code:
name: Here we use Ansible debug debug:
Output:
ansible-playbook debug_dafault_msg.yml
Example #2To print the value of a variable that was defined in the same playbook. we can create a simple playbook like below:
Code:
var: fruit
Output:
ansible-playbook debug_print_var.yml
Example #3To print an Ansible fact of remote hosts, we can create a simple playbook like
Code:
Output:
ansible-playbook debug_ansible_fact.yml
Example #4To print a customized message on the screen, Write a playbook like below:
Code:
msg: “This is machine is {{ ansible_hostname }} with IP {{ ansible_default_ipv4.address }}”
Output:
ansible-playbook debug_with_customized_msg.yml
Example #5You can register the output of a task in a variable and as we know the values of these variables will be stored in JSON format. So, you can call that variable later in the same playbook. To test this or to test which value will be used when we call registered variables. We can use debug like below, creating a playbook.
Code:
Output:
ansible-playbook debug_register_values.yml
Example #6Controlling Verbosity is done by giving values against parameter verbosity and then mentioning the same or more number of –v while running the playbook. Like the playbook in previous. Where we didn’t define any verbosity, then by default it ran with 0 verbosity level. But if define the verbosity level like below:
Code:
var: free_mem.stdout_lines verbosity: 1
Output:
ansible-playbook debug_register_values.yml -v
ConclusionAnsible debug module is a very helpful tool for playbook developers and for administrators who work on need to update a playbook frequently on per need basis. Also, while working in a team where others also have the same stakes as you, using the debug module to add more information is always beneficial and can avoid confusion and dependencies.
Recommended ArticlesThis is a guide to Ansible Debug. Here we discuss an introduction to Ansible Debug, how does it work with examples. You can also go through our other related articles to learn more –
How To Write A Bug Report With Examples
What is Bug Report? Why do you need a good bug report?
The purpose of this post-testing documentation is to provide information to the concerned team of professionals about the level of bugs encountered during the testing process.
Your software development engineer can be made aware of all the defects and issues present in the software using this type of report. It also lets you figure out what’s wrong with a bug, so you can use the best method to fix it. It also helps you to save your time and money by helping you catch bugs and issues.
Why should you care about good bug explanations?Here is the point that you need to consider for writing a good, detailed software bug report:
It acts as a guide to help avoid the same bug in future releases.
Save time for communication (e-mails, calls).
Less work for developers (they will do exactly what you want).
You will have less bottlenecks in the project; bugs will be fixed faster and more efficient way.
How to Write Bug Report (Bug Report Template)
There is no exact bug report template, as it depends upon your bug-tracking system. Your template might be different.
However, the following common fields are always needed when you want to write a bug report:
Bug id/ Title.
Severity and Priority.
Description
Environment
Steps to reproduce.
Expected result.
Actual result.
Attachments (screenshots, videos, text)
Let’s look at all these bug-tacking components one by one:
1) Title/Bug ID:Every bug should be given a unique identification number. Bug reporting tools should be unique numbers for the newly raised bugs so we can easily identify the bug.
Examples:
❌ Bad: “I can’t see the product when I again, tyrp it doesn’t.”
Vague
Aggressive
Too wordy
asks for a solution to be implemented.
✅ Good: “CART – New items added to the cart that does not appear”.
This kind of Title instantly locates the issue (CART)
It focuses on the actual technical problem.
2) Bug Severity:Bug severity is a very important factor in the bug report. It describes the effect of the defect on the application’s performance.
Blocker: This error causes the app to fail.
Major: A critical error indicates a major change in the business logic.
Minor: An issue that doesn’t affect the application’s functionality but does affect the expected results.
Trivial: It does not affect the functionality or operation of the app. It could be a typographical error.
3) Bug Priority:Following is the general gradation to decide bug priority:
High: It covers anything which affects the flow or blocks app usage.
Minor: All other errors like (typos, missing icons, layout issues, etc.).
4) Environment:A Bug can appear in a specific environment and not others. For example, sometimes a bug appears when running the website on Firefox, or an app malfunction only when running on an Android device and working fine on iPhone.
These bug reports can only be identified with cross-browser or cross-device testing. So, when reporting the bug, QAs should be able to specify if the bug should be observed in one or more specific environments.
5) Summary:However, adding only the Title in the bug report does not serve the purpose. So, if your Title isn’t enough, you can add a short report summary.
Your summary in as few words as possible including when and how the bug occurred. Your Title and bug description should also be used in searches, so you must ensure you have covered important keywords.
Examples:
6) Steps to reproduce:
When reporting a bug, it is important to specify the steps to reproduce it. You should also include actions that may cause the bug. Here, don’t make any generic statements.
Be specific on the steps to follow:
Here, is an example of well-written procedure:
Steps:
Select product X1.
7) Expected result:In bug reports, describing the expected result per the technical task, test case outcomes design, or according to the tester’s opinion is important. All this helps developers to focus on quickly finding needed information.
For example:
8) Actual result:As it names suggests, this s field describes the actual effect of the bug. It is very important to write a clear description of the actual result.
For example:
9) Attachments (screenshots and videos):In bug reports, it is best practice to attach files to bug reports which makes it easier to perceive information when you need to display it visually:
For example:
Screenshot: Screenshots can easily elaborate mistakes in the program; s convenient when the bug is highlighted with a specific annotation, circle, or arrow image).
Video: Sometimes, it is difficult to describe the bug in words, so it’s better to create a video so that developer can rectify the defect in the program).
10) Affected Version:It is the affected software version where the bug is reported.
11) Fix Version:It is the software version in which the bug is resolved. So when the QA who reported the bug, checks whether it is fixed, he uses the correct software version.
12) Target version:The target version where a bug should be targeted to be fixed. So, when the development team works on fixing a bug, they mostly target a particular application version.
13) Date Closed:It is the date when the bug is closed by the software testing team. Closing a bug is a vital and integral part of software testing.
14) Status:When a new bug is created, its status should be open. After that, it goes through stages like In Progress, Fixed, Running, Reopen, etc.
Tips for Bug Report WritingHere are some important tips that you should remember while writing an effective bug report:
Be specific when creating bug reports. Make sure you don’t include any useless or irrelevant facts.
You must report the bug immediately as soon as it gets detected.
Prepare the report in detail to empower the developer to use the facts and the information to debug the issue.
You should test the same bug occurrence on other similar modules for validation.
Review the bug report at least once before submitting it.
You should ensure that the bug report contains the description of only one error.
Lastly, you should not be afraid to ask the Project Manager for help if you feel unclear about something.
Bug Reporting toolsThe bug reporting process, performed manually, is now being performed with various bug reporting tools available in the market.
JIRA
Zoho Bug Tracker
Bugzilla
You can check our detailed review of the best bug reporting tool.
Common Problem and Solution while Writing a bug report:Here are some common problems and their solutions while writing a bug report:
Bug Report Example Problem
When multiplying 2 by 3, the answer will be positive. Report the pattern, not an example.
The list will be ordered alphabetically when adding a new item to avoid this. Don’t only describe what’s wrong
To being, you will need to open your browser and type the site’s URL. You’ll find the first field, ‘username,’ misspelled. Always direct to the point (Never tell the story!).
The client’s name in the report is misspelled. Priority: High, Severity: High Never mix priority and severity.
The tax calculation formula is INCORRECT !!?? Does not use CAPS, red letters, red circles, ‘!’,
I don’t think that the home page Ul design is good. Don’t use your judgment.
Example of unclear description: About our discussion today, please do the required action for this page. Make your description understandable for everyone.
This is not good as it is unclear what is needed from the web development and design team
Minimize the options
The tax calculation formula is sometimes not working as expected. The golden rule: Don’t use the word ‘Sometimes’.
Example of Bug ReportHere is a small example of a bug report:
[MY ACCOUNT] Underline is displayed when mouseovering on the Update button.
Description: We need to remove the underline when mouseovering on the Update button in My Account section.
Browser/OS: Chrome 25. OSX Yosemite 10.10.2
Steps to reproduce:
2. Login via login credentials
3. Navigate to My Account
4. Mouseover on the Update button
Actual result: there is an underline.
Expected Result: no underline.
Must avoid mistakes in bug report writingHere are some important mistakes that you should avoid while writing a bug report:
Don’t write about your dissatisfaction, and never include your personal feelings.
It annoys people who want to focus on the task when you overload your post with many emoticons.
Never overload your post with exclamation points; it does not speed up the work.
Nobody wants to feel offended. It destroys motivation and slows the realization of the issue.
How To Perform Migrate In Flask With Examples?
Definition on Flask Migrate
Flask migrate is defined as an extension that is used in the Flask application for handling database migrations for SQLAlchemy using Alembic. This module enables developers to quickly set up and starts the database schema migrations. The reason we require database migrations can be explained as follows. Suppose we build a database, and then require it to be modified by adding an extra column. Post addition we feel that the schema now present doesn’t fit well into the full application architecture and would like to return back to the original one. In a normal case it is difficult to do so, but with flask migrate the tasks are much smoother! In this article, we will look at ways on how we perform migration in Flask.
Start Your Free Software Development Course
Web development, programming languages, Software testing & others
SyntaxInstalling flask migrate and configuring it:
pip install flask-migrateInstalling SQLAlchemy in Flask:
pip install flask-sqlalchemyConfiguring the Database URI in configuration parameter:
Initializing Migrate command:
Creation of migration repository:
flask db initCreation of initial migration:
flask db migrate How to perform migrate in Flask?Before we think about performing migrate in Flask, we need to make sure that the module is installed in the python environment. For that, we would need to run the command pip install flask-migrate which will ensure that the module is installed in the environment where the python code will be running from. One needs to also make sure that the SQL alchemy module is also installed for smooth running of the migrate in Flask. Once everything is set, we are ready for the next steps in performing migrate in Flask.
Flask applications sometimes feel the necessity to dynamically using or insert their own settings in the Alembic configuration. For taking care of the utility, we use the decorator utility which uses the configure callback. Post the decorator utility and callback a function is defined. This function can modify the configuration object or completely replace it with the new variable within the function. Using decorator allows usage of multiple configuration callbacks and the order in which the callbacks are invoked are undetermined. Once the configuration piece is sorted, it would be time for binding the databases. The installation of the SQL alchemy module provides features to allow Flask-migrate to track migrations to multiple databases. This is possible with the binds feature of SQL alchemy. Including –multidb argument into the command enables the creation of multiple database migration repositories.
The flow follows as:
from flask_script import Manager from flask_migrate import MigrateCommand appFlask = Flask(__name__) manager = Manager(appFlask) ExamplesLet us discuss examples of Flask Migrate.
Example #1Installation of the Flask migrate module in Python environment:
Syntax:
pip install flask-migrateOutput:
Example #2Initializing the migrate instance:
from flask_migrate import Migrate from flask import Flask appFlask = Flask(__name__) from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy(appFlask) migrate = Migrate(appFlask, db) migrateOutput:
Example #3Adding the MigrateCommand into the list of commands in the manager:
Syntax:
from flask_script import Manager from flask_migrate import MigrateCommand from flask import Flask appFlask = Flask(__name__) from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy(appFlask) manager = Manager(appFlask) manager.add_command('db', MigrateCommand) managerOutput:
ConclusionIn conclusion, in this article, we have learned about the migrate configuration and application in Flask. We can also use this methodology to include migration of an existing project as well so that developer doesn’t need to delete everything and then start from scratch. The only thing which needs to be kept in mind during the task of including migration in an existing project is some changes need to be made in the models of the source code. Like anytime else, rest is to you for experimentation.
Recommended ArticlesThis is a guide to Flask Migrate. Here we discuss the definition, syntax, How to perform migrate in Flask? and examples respectively. You may also have a look at the following articles to learn more –
How Php Ucwords() Works With Examples
Introduction to PHP ucwords()
Ucwords() in PHP is a built-in function. It is helpful to convert the first and foremost character of a string into uppercase. The ucwords() only supports PHP 4 & above versions. ucwords() function takes a string as an input value and it outputs the string by changing the first letter/character of the string into uppercase. Other than this every other character remains the same as the previous time. The ucwords() function in PHP returns converted to string by changing the first letter of all words to uppercase.
Start Your Free Software Development Course
Web development, programming languages, Software testing & others
Syntax Ucwords($string, $separator)The ucwords() syntax accepts just two parameters.
1. $string( string mandatory ): Between the parenthesis of ucwords() function, string input is required. It is a must and mandatory to this function declaration in order to specify the string which is to be converted.
2. $separator ( Optional Parameter ): Separator is the optional parameter of ucwords() function. It contains words separator characters. The separator used in the input string for the words. The listed characters which are listed below are by default:
t for tab
Space
r for Carriage return
n for newline
v for vertical tab
f for form feed
$Separator parameter added in 5.5.16, 5.4.32 versions of PHP.
How PHP ucwords() works?PHP ucwords works when the text/words contain mixed types of letters/characters inside words. Only the first character of the word/ first characters of all the words which are in the sentence will be converted to capital letters. It works using a string value that contains word/words and it also uses one separator/delimiter value but it is optional. No issue with the separator variable.
Examples of PHP ucwords()Given below are the examples
Example #1How the basic program works by using ucwords() PHP function.
Code:
<?php $input_string = "hey buddy, pavan sake is coming just wait."; echo "Before:". $input_string; $result_string = ucwords($input_string); echo "After: ".$result_string;Output:
Example #2Code:
<?php $result_string1 = ucwords($input_string); echo $result_string2;Output:
Example #3This example here is to use ucwords() function on arrays which has a list of names/strings by removing delimeters/parameters “–“ and “”.
Code:
<?php function ucname($string1) { $string1 =ucwords(strtolower($string1)); foreach (array('-', ''') as $parameters1) { if (strpos($string1, $parameters1)!==false) { $string1 =implode($parameters1, array_map('ucfirst', explode($parameters1, $string1))); } } return $string1; } <?php $names1 =array( 'SAKE-PAVAN KUMAR', 'ANIL O'KUMAR', 'MARUTHI PRASAD', 'surendra la gandham', 'rAjAsEkHaR KAtUbaDi' ); /* Sake-Pavan Kumar Anil O'Kumar Maruthi Prasad Surendra La Gandham Rajasekhar Kattubadi */Output:
Example #4This is one of the sample programs of ucwords function.
This program has features like:
Multibyte/bytes Compatability
It handles delimiters even if there are multiple
Code:
<?php function ucwords_specific1 ($string1, $delimiters1 = '', $encoding1 = NULL) { if ($encoding1 === NULL) { $encoding1 = mb_internal_encoding();} if (is_string($delimiters1)) { $delimiters1 = str_split( str_replace(' ', '', $delimiters1)); } $delimiters_pattern11 = array(); $delimiters_replace11 = array(); $delimiters_pattern21 = array(); $delimiters_replace21 = array(); foreach ($delimiters1 as $delimiter1) { $uniqid1 = uniqid(); $delimiters_pattern11[] = '/'. preg_quote($delimiter1) .'/'; $delimiters_replace11[] = $delimiter1.$uniqid1.' '; $delimiters_pattern21[] = '/'. preg_quote($delimiter1.$uniqid1.' ') .'/'; $delimiters_replace21[] = $delimiter1; } $return_string1 = $string1; $return_string1 = preg_replace($delimiters_pattern11, $delimiters_replace11, $return_string1); $words1 = explode(' ', $return_string1); { $words1[$index1] = mb_strtoupper(mb_substr($word1, 0, 1, $encoding1), $encoding1).mb_substr($word1, 1, mb_strlen($word1, $encoding1), $encoding1); } $return_string1 = implode(' ', $words1); $return_string1 = preg_replace($delimiters_pattern21, $delimiters_replace21, $return_string1); return $return_string1; } <?php mb_internal_encoding('UTF-8'); $string1 = "PAVAN KUMAR-SAKE d'alltechscience şŠ-òÀ-éÌ hello - web"; echo ucwords_specific1( mb_strtolower($string1, 'UTF-8'), "-'");Output:
The main parameters which are involved in the above program are $string1, $delimeter1, $delimiters, encoding. Delimeter/Delimeters are the parameters that are an option but needed In the development. The string is the parameter that is to be converted. The encoding parameter is to know the character encoding. Internal characters encoding value/values will be used if the parameter don’t omits.
Example #5Code:
<?php $title1 = 'PAVAN "THE KING" SAKE - (I WANT TO BE YOUR) SERVANT'; echo ucwords(strtolower($title1)); <?php function my_ucwords($string1) { $noletters1='"([/'; for($i=0; $i<strlen($noletters1); $i++) $string1 = str_replace($noletters1[$i], $noletters1[$i].' ', $string1); $string1=ucwords($string1); for($i=0; $i<strlen($noletters1); $i++) $string1 = str_replace($noletters1[$i].' ', $noletters1[$i], $string1); return $string1; } $title1 = 'PAVAN "THE KING" SAKE - (I WANT TO BE YOUR) SERVANT'; echo my_ucwords(strtolower($title1));Output:
Example #6This is the example of the code below which will convert all your words into small letters except the first letter. They will be a capital letter. Here ucfirst() function is used. It is also a part of ucwords() function.
Code:
<?php $text1 = "What Buddy ? No 'parameters',shit! "happening" chúng tôi solves many problems now???"; for ($i = 0; $i < count($data1[0]); $i++) { $data1[0][$i] = ucfirst($data1[0][$i]); } $text1 = implode("", $data1[0]); print $text1;Output:
The above program’s output contains the same text which is under $text1 variable but just the first characters of the words which are listed in the variable will be changed to the capital letters remaining ones will remain as small letters.
Recommended Articles
This has been a guide to PHP ucwords(). Here we discuss syntax, parameters, and examples of PHP ucwords(). you may also have a look at the following articles to learn more –
Update the detailed information about How To Use Isblank With Examples on the Kientrucdochoi.com website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!