Starting Out with Programming Logic and Design (4th Edition)
Starting Out with Programming Logic and Design (4th Edition)
4th Edition
ISBN: 9780133985078
Author: Tony Gaddis
Publisher: PEARSON
Question
Book Icon
Chapter 12, Problem 5SA
Program Plan Intro

Inserting or deleting characters in a string:

  • Library function or modules are provided by the programming languages to perform insert and deletion operations.

Inserting:

The pseudocode library modules that are used to insert the values is :

insert (string1,position,string2)

  • The above function will insert the “string 2” to the “string1” at the “position” specified.
  • “string1” and “string2” is string
  • “Position” is an integer.

Deleting:

The pseudocode library modules that are used to insert the values is

delete (string1,start,end)

  • The above function will delete the strings that are specified from the start to the end.
  • “Start” and “End” is integer that specifies the beginning position and end position.
  • “String” is string.

Example:

The below statement is used to delete the first three characters from the string “city”.

//deletes first three character in city

delete (city, 0, 2)

Explanation:

  • The above function will delete the strings present in the “city” variable that is specified from the position “0” to the position “2”.
  • The above function will delete the first three character of the “city” string.
  • On execution, the “city” will hold “ton” as its value.

Blurred answer
Students have asked these similar questions
In Python, you can use ______ to create Strings. single quotes (') double quotes (") three single quotes (''') All of the above A and B only None of the above
What will the following Code segment print on the screen?    String LName = "FamilyName";   String FName = "GivenName";   System.out.println("Dear Mr " + LName);   System.out.println("We would like to call you " + FName);
Most Frequent Character: (see textbook page 436)( write psedocode too and use python)     Write a program that lets the user enter a string and displays the character that appears most frequently in the string. Suggest using count, alphabet_string = 'abcd….z', upper(), find(), and len(). Attached: text.txt for testing

Chapter 12 Solutions

Starting Out with Programming Logic and Design (4th Edition)

Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    Microsoft Visual C#
    Computer Science
    ISBN:9781337102100
    Author:Joyce, Farrell.
    Publisher:Cengage Learning,
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,