Question

In: Computer Science

A. Describe situations in which it might be necessary to trim leading or trailing characters from...

A. Describe situations in which it might be necessary to trim leading or trailing characters from string data input by the user?

B. Describe situations in which it might be necessary to pad string data or to replace portions within a string? Consider phone numbers, Social Security numbers, and address details.

C. What are other useful methods that use to manipulate a string?

Solutions

Expert Solution

A. We need to Trim leading and trailing characters from string data input by the user in the situations like entering email or some case sensitive data if we add spaces at the end or in front the value of data we entered will be changed because computers encode the values of the space and change the Unicode of entire data

B. Padding a string and replacing some portions are quite normal in string manipulation techniques like when you are entering some data into the web browser it needs to know what kind of data you are entering. When entering a phone number we need to pad it especially otherwise there will be a chance to consider it as some other number which is related to your address and Padding the letters in the right way helps the others to get most of the knowledge by seeing only.

Replacing some portions of string-like when there is two spaces afterword to word doesn't make any sense and it even looks odd to the people who are watching it so in that case we need to replace those two spaces with one space. And mostly when you are starting to write something we need to start it with Captial letter after pull stop in that case replacing helps us to Make the first letter capitalize.

C. There are lots of string manipulation techniques available now.

Here I am gonna write about some of the useful string manipulation techniques

Length: Getting the length of the string is very useful as it restricts the input of data to the maximum length we defined to the string. We can even also set the minimum length of the string.

Upper/Lower: We can make the strings all as capital and all as lower which helps the string to change all its characters to Captial letters or Lower letters. This is mostly used while taking an email address from the user even he entered email address with capital letters the system automatically converts them into small and gives access to the email.

Join: We can join the string with a letter or some other string.

index of: This is mostly used to access the position of the letter in a string. It will tells about where the character is located

Substring: This substring technique helps us to extract the substring which is some part of String.

I hope this answer Helps to you!

Feel free to comment in the comment section if you have any doubts or queries

Thank you! do upvote.


Related Solutions

Describe some sampling situations in which a sampler which takes a stratified sample would be necessary.
Describe some sampling situations in which a sampler which takes a stratified sample would be necessary.
(a) Which might describe a heat engine? (b) Which might describe a heat pump? (c) Which might describe a refrigerator? Explain.
(a) Which might describe a heat engine? (b) Which might describe a heat pump? (c) Which might describe a refrigerator? Explain.The figure shows PV diagrams for five cyclical processes. (Cycle D is a simplified model of a steam engine cycle.)
Describe two situations in which you would use a list; two situations in which you would...
Describe two situations in which you would use a list; two situations in which you would use a tuple, and two situations in which you would use a dictionary. Also do some research to learn about data structure sets, describe when and how to use sets.
name and discuss three different crisis situations in which a person might be victimized and also...
name and discuss three different crisis situations in which a person might be victimized and also address how steps can be taken to assist with these situations when they do occur.
How do you recognize in which situations the idea of strong induction might be useful?
How do you recognize in which situations the idea of strong induction might be useful?
Choose a business and describe examples of situations where the business might need business income insurance...
Choose a business and describe examples of situations where the business might need business income insurance and consequential damage coverage.
Choose a business and describe examples of situations where the business ness might need business income...
Choose a business and describe examples of situations where the business ness might need business income insurance and consequential dam- age coverage.
3. Is synergy a valid rationale for mergers? Describe several situations that might produce synergistic gains?...
3. Is synergy a valid rationale for mergers? Describe several situations that might produce synergistic gains? refer financial management 16th edition by Brigham and Ehrhardt please provide the complete answer in a detailed way
Describe the different leadership styles and the situations in which they are used. What are the...
Describe the different leadership styles and the situations in which they are used. What are the three considerations of Fiedler's contingency theory? Fiedler's theory assumes that leaders are effective when leadership styles are matched to the proper situation and that favourable situations permit leaders to influence group members. The three considerations of the model are _________________ (the degree to which followers respect, trust and like their leaders), ___________________ (the degree to which the requirements of a subordinate’s tasks are clearly...
When the last sale price of HSHK is $25, I enter a stop loss order to sell at $22 trailing by $3. In which of the following situations does my order get triggered?
When the last sale price of HSHK is $25, I enter a stop loss order to sell at $22 trailing by $3.In which of the following situations does my order get triggered?State what the corresponding stop prices are and finally whether it is triggered or not and the triggered 6 price.a. $25 is followed by trades at $23, $28 and $29.b. $25 is followed by trades at $30, $31 and $28.c. $25 is followed by trades at $24, $27, $25...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT