% Matlab file - stringManip.m
% Matlab function that takes in a character string and modifies it and
% return it
function [modString] = stringManip(inString)
modString = inString;
% loop through all the characters in the string
for i=1:length(inString)
% if string contains a vowel
if(lower(inString(i))=='a' || lower(inString(i)) =='e' || lower(inString(i)) == 'i' || lower(inString(i)) =='o' || lower(inString(i)) == 'u')
modString(i)='&';
else
[n,OK]=str2num(inString(i)); % if string contains a number then n will conatin that number else it will be empty
if(~isempty(n))
n = n+1;
if(n == 10)
n=0;
end
modString(i) = num2str(n);
end
end
modString(i) = upper(modString(i));
end
modString(length(modString)) ='!'; % replace final charcater by !
modString = strcat(modString,num2str(length(modString))); % concatenate the length of the string at the end
end
% End of Matlab function
Output:
Note: Could you please consider my effort on this work and give me a UPVOTE. Thank you :)
2) Write a function stringManip that takes in a character string and returns a character string...
Write a program that replace repeated three characters in a string by the character followed by 3. For example, the string aabccccaaabbbbcc would become aabc3ca3b3cc. When there are more than three repeated characters, the first three characters will be replaced by the character followed by 3. You can assume the string has only lowercase letters (a-z). Your program should include the following function: void replace(char *str, char *replaced); Your program should include the following function: void replace(char *str, char *replaced);...
10. replaceSubstring Function Write a function named replaceSubstring. The function should accept three C-string or string object arguments. Let's call them string1, string2, and string3. It should search string for all occurrences of string2. When it finds an occurrence of Programming Challenges string2, it should replace it with string. For example, suppose the three arguments have the following values: stringt: "the dog jumped over the fence" string 2 "the" string3: "that" With these three arguments, the function would return a...
Write a Python function called more() that takes three string inputs and outputs a string Formally, the function signature and output are given by rucharist, char: str words str) > str Use the same names for the input arguments as shown above Note that charl and char2 will always be a string of length 1 (ie, it is a single character. The function checks which of charl or char2 appears more often in the word string and returns that character...
In python Exercise 4 (graded) Write a function "passValidate" that takes a string "s" and checks the validity of string as a password Validation Rules: At least 1 lowercase letter between [a-z] and 1 upper case letter between [A-Z]. At least 1 number between [0-9 At least 1 character from [$#@]. Minimum length 6 characters. Maximum length 16 characters. CS103-Lab 13 Page 3 of 3 Sample Input: s"Uab@2762" Sample Output: True
String data and string manipulations are a major capability in any type of data processing. Character arrays are rather limited compared to String data types. This application will: 1. Allow the user to enter a string (multiple words including blanks) 2. Determine the number of vowels (a, e, i, o, u) and non vowels.a. Total number of Individual a’s, e’s, i’s, o’s, u’sb. Uppercase vowels count the same as lowercase vowels (i.e. “A” is the same as “a”)c. Any other...
python3.x Write a function print_letter_count(word) that takes a string as a parameter and prints each unique character (in alphabetical order and lowercase) together with their frequency. For example: consider the following word: Programming The characters are: 1 x p, 2 x r, 1 x o, 2 x g, 1 x a, 2 x m, 1 x i and 1 x n. The output would be: a: 1 g: 2 i: 1 m: 2 n: 1 o: 1 p: 1 r:...
Add or Subtract. Write a function (add-sub-string s). The function consumes a Str of even length, where every even- numbered character is either "+" or "-", and odd-valued characters are numeric The function should add up all the digits that follow a "+", and subtract all the digits that follow a "-". For example, (add-sub-string "+3+4-5") => 2 (add-sub-string "-5+3+4-6-6") - 10 => The interface file contains the function char->nat that converts a numeric Char to the corresponding numeric value....
Objectives: Use strings and string library functions. Write a program that asks the user to enter a string and output the string in all uppercase letters. The program should then display the number of white space characters in the string. You program should run continuously until the user enters an empty string. The program must use the following two functions: A function called count_spaces that counts the number of white spaces inside a string. int count_space(char str[]); which tell you...
Write an LC-3 program (starting at memory location 0x3000) to take a string as input and then output information about this string. The end of the string will be denoted with the "#" character. Once the "#" has been found, output the following in order: 1) The letter “u” followed by the number of uppercase letters in the string (A-Z) 2) The letter “l” followed by the number of lowercase letters in the string (a-z) 3) The letter “n” followed...
Question 2 - Objects You are to implement the following functions: getCharacterFrequency -10pts This function takes a single string (str) argument and returns an object. o The object's properties will be the unique letters present in str The value of each property will be the frequency of each character present in the string. NOTE: Uppercase and Lowercase letters should be grouped in the same count. For example, the word Babble would result in the following object "B3, 11 This count...